~ubuntu-branches/ubuntu/hoary/scilab/hoary

« back to all changes in this revision

Viewing changes to macros/m2sci/sci_meshgrid.sci

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2005-01-09 22:58:21 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050109225821-473xr8vhgugxxx5j
Tags: 3.0-12
changed configure.in to build scilab's own malloc.o, closes: #255869

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
function [stk,txt,top]=sci_meshgrid()
2
 
// Copyright INRIA
3
 
txt=[]
4
 
if rhs<=2 then
5
 
  if rhs==1 then
6
 
    X=stk(top)(1);[mx,nx]=checkdims(stk(top));
7
 
    Y=X;my=mx;ny=nx;
8
 
  else
9
 
    X=stk(top-1)(1);[mx,nx]=checkdims(stk(top-1));
10
 
    Y=stk(top)(1);[my,ny]=checkdims(stk(top));
11
 
  end
12
 
  txt='// inline translation of meshgrid('+makeargs([X,Y])+')'
13
 
  if lhs==2 then
14
 
    [U,V]=lhsvarsnames()
15
 
    if mx==1 then
16
 
      txt=[txt;U+'='+X]
17
 
    else
18
 
      txt=[txt;
19
 
          U+'=matrix('+X+',1,-1)']
20
 
    end
21
 
    if ny==1 then
22
 
      txt=[txt;V+'='+Y]
23
 
    else
24
 
      txt=[txt;
25
 
          V+'=matrix('+Y+',-1,1)']
26
 
    end
27
 
    
28
 
    txt=[txt;
29
 
        U+'='+U+'(ones('+U+'),:)'
30
 
        V+'='+V+'(:,ones('+V+')'')']
31
 
    stk=list(list(U,'0','?','?','1'),list(V,'0','?','?','1'))
32
 
  else
33
 
    U=lhsvarsnames()
34
 
    if U==[] then U=gettempvar(),end
35
 
    if mx==1 then
36
 
      txt=[txt;U+'='+X]
37
 
    else
38
 
      txt=[txt;
39
 
          U+'=matrix('+X+',1,-1)']
40
 
    end
41
 
    
42
 
    txt=[txt;
43
 
        U+'='+U+'(ones('+U+'),:)']
44
 
    stk=list(U,'0','?','?','1')
45
 
  end
46
 
else
47
 
  X=stk(top-2)(1)
48
 
  Y=stk(top-1)(1)
49
 
  Z=stk(top)(1)
50
 
  X='mtlb_meshgrid('+makeargs([X,Y,Z])+')'
51
 
  stk=list(list(X,'-1','?','?','1'),list(X,'-1','?','?','1'))
52
 
end
53
 
 
54