Parse Error in funtion

1 visualización (últimos 30 días)
Sanjoy Dey
Sanjoy Dey el 3 de Abr. de 2019
Respondida: Bjorn Gustavsson el 3 de Abr. de 2019
p=0;
for k=0:5
if(c(k)~= t)
continue;
else
position=k;
value=a(position);
swap(p++) = value;
user(k++)=position;
max=swap(0);
end
end
m=0;
while(m<j)
if(max<swap(m))
max=swap(m);
m=m+1;
end
end
Showing parse error in two line swap(p++)=value and user(k++)=position.
Give me a sloution for this error.

Respuesta aceptada

Bjorn Gustavsson
Bjorn Gustavsson el 3 de Abr. de 2019
Simples,
k++
is not valid matlab syntax, sadly according to some, but fact. You'll have to do an excplicit incrementations:
k = k+1;
p = p+1;
inside your else clause.
HTH

Más respuestas (0)

Categorías

Más información sobre String Parsing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by