Syntax error in octave

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Syntax error in octave

Magn3t
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



Thank u  on advance