Parse Error in funtion

조회 수: 1 (최근 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 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