Parse Error in funtion

1 次查看(过去 30 天)
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.

采纳的回答

Bjorn Gustavsson
Bjorn Gustavsson 2019-4-3
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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 String Parsing 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by