help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Syntax error in octave


From: Magn3t
Subject: Syntax error in octave
Date: Thu, 27 Apr 2017 10:57:53 -0700 (PDT)

hello everyone, 
i'm running an octave script and everything was running good but when i copy
and paste this script, i get syntax error and parse error near line 54: 

function Caminho = obtem_caminho (Altitudes)
 a=0;
 b=0;
 c=0;
 
 x=1;
 y=1;
  
 Caminho=[1,1,Altitudes(1,1)];
 [m,n]=size(Altitudes);
  
  while x~=m && y~=n
  
    a=Altitudes(x+1,y+1);
    b=Altitudes(x,y+1);
    c=Altitudes(x+1,y);
    
    if a <= b && a <= c
      x=x+1;
      y=y+1;
      Caminho=[Caminho;x,y,Altitudes(x,y)];
      
    else if b <= c
      x=x;
      y=y+1;
      Caminho=[Caminho;x,y,Altitudes(x,y)];
      
    else 
      x=x+1;
      y=y;
      Caminho=[Caminho;x,y,Altitudes(x,y)];
      
    end
   
  while x~=m && y==n
    x=x+1;
    y=y;

>> obtem_caminho (Altitudes)
parse error near line 54 of file C:\Users\Ana Mota\Desktop\obtem_caminho.m

  syntax error
    Caminho=[Caminho;x,y,Altitudes(x,y)];
   
  end
  
  while y~=n && x==m
    x=x;
    y=y+1;
    Caminho=[Caminho;x,y,Altitudes(x,y)];
     
  end
end

 Nothing appears to be wrong because the file i download works good but  
after copy and paste doesnt work anymore .. and when iwant to submit the
file i get this

<http://octave.1599824.n4.nabble.com/file/n4683077/18176053_1687803757913164_2079445965_o.png>
 

Thank u  on advance



--
View this message in context: 
http://octave.1599824.n4.nabble.com/Syntax-error-in-octave-tp4683077.html
Sent from the Octave - General mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]