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

« back to all changes in this revision

Viewing changes to macros/scicos/value2modelica.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 txt=value2modelica(v)
 
2
  [m,n]=size(v)
 
3
  if m==1&n==1 then
 
4
    txt=stripblanks(sci2exp(v))
 
5
    kdot=strindex(txt,'.')
 
6
    if kdot==[] then return,end
 
7
    if kdot==1 then 
 
8
      txt='0'+txt
 
9
    else
 
10
      if or(part(txt,kdot-1)==['+','-']) then
 
11
        txt=part(txt,1:kdot-1)+'0'+part(txt,kdot:length(txt))
 
12
      end
 
13
    end
 
14
  else //matrix case
 
15
    txt=stripblanks(sci2exp(v,0))
 
16
    kdot=strindex(txt,'.')
 
17
    if kdot==[] then return,end
 
18
    k=strindex(part(txt,kdot-1),['+','-',',',';','['])
 
19
    if k==[] then return,end
 
20
    t=txt;txt='';k0=1;
 
21
    for i=k
 
22
      ki=kdot(i);
 
23
      txt=txt+part(t,k0:ki-1)+'0';
 
24
      k0=ki;
 
25
    end
 
26
    txt=txt+part(t,k0:length(t))
 
27
  end
 
28
endfunction