필터 지우기
필터 지우기

why loop missing or extra characters

조회 수: 2 (최근 30일)
Craig Johnson
Craig Johnson 2022년 10월 26일
댓글: Image Analyst 2022년 10월 26일
w0=ones(4000,1)
A=readmatrix('matrix.txt')
count1=0
count2=0
while
Invalid expression. Check for missing or extra characters.

Error in connector.internal.fevalMatlab

Error in connector.internal.fevalJSON
time1=tic
[lam,i]=powereig(A,w0,1)
fprintf('With the tolerance set to 1, the estimated eigenvalue is:%f',i)
count1=count1+1
fprintf('Iteration count:%d',count1)
break
end
while
time1=tic
[lam,i]=powereig(A,w0,10^-5)
fprintf('With the tolerance set to 1, the estimated eigenvalue is:%f',i)
count2=count2+1
fprintf('Iteration count:%d',count2)
ftime2=toc
fprintf('powereig() Time Elapsed:%d',ftime2)
break
end
Error: File: Lab3_B_505863264.m Line: 5 Column: 6
Invalid expression. Check for missing or extra characters.

답변 (1개)

Image Analyst
Image Analyst 2022년 10월 26일
편집: Image Analyst 2022년 10월 26일
You need to have a condition for the while statement that tells it when to continue or quit the loop. You have just a bare while with no condition at all after it!
  댓글 수: 2
Craig Johnson
Craig Johnson 2022년 10월 26일
oh right thanks
Image Analyst
Image Analyst 2022년 10월 26일
If that solves your problem, can you click the "Accept this answer" link 🙂,
or else tell me what is still not working.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by