Error using plot Vectors must be the same length.

2 vues (au cours des 30 derniers jours)
Muhammed Çevik
Muhammed Çevik le 26 Déc 2020
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

Réponse acceptée

Ive J
Ive J le 26 Déc 2020
Modifié(e) : Ive J le 26 Déc 2020
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)
  1 commentaire
Muhammed Çevik
Muhammed Çevik le 26 Déc 2020
Thank you so much .It works great.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Develop Apps Using App Designer dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by