Parse Error in funtion

4 ビュー (過去 30 日間)
Sanjoy Dey
Sanjoy Dey 2019 年 4 月 3 日
回答済み: Bjorn Gustavsson 2019 年 4 月 3 日
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 Center および File ExchangeString Parsing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by