Error using plot Vectors must be the same length.

조회 수: 2 (최근 30일)
Muhammed Çevik
Muhammed Çevik 2020년 12월 26일
편집: Muhammed Çevik 2020년 12월 30일
Hi everyone,
I want to add the number m to the K array after 25 loops. But I have some problems with K array. How can I fix that problem?
function ButtonPushed(app, event)
plot(app.UIAxes2,0:200,K); %Error using plot Vectors must be the same length.
% I decreased and increased 200 but didn't work.
end

채택된 답변

Ive J
Ive J 2020년 12월 26일
편집: Ive J 2020년 12월 26일
The error is quite clear, 0:200 size doesn't match that of K. numel(0:200) is 201 while numel(K) is 199. It's better to replace if with
plot(0:numel(K)-1, K)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by