Effacer les filtres
Effacer les filtres

Why won't matlab plot data from a table?

4 vues (au cours des 30 derniers jours)
Daniel Montgomery
Daniel Montgomery le 21 Fév 2020
Réponse apportée : Rik le 21 Fév 2020
%I am getting an empty plot from this code.
x1=linspace(0,500000,1000);
for x=1:17
y=lightint{x,1}
plot(x1,y)
end
  2 commentaires
Sindar
Sindar le 21 Fév 2020
It looks like y is a scalar value. Is that intentional?
Daniel Montgomery
Daniel Montgomery le 21 Fév 2020
It is intentional.

Connectez-vous pour commenter.

Réponse acceptée

Rik
Rik le 21 Fév 2020
You're trying to plot a scalar multiple times, which Matlab happily does for you. You won't see anything, because your line style doesn't include a marker for single points. You also forgot hold on, so every iteration will wipe the previous.
x1=linspace(0,500000,1000);
for x=1:17
y=lightint{x,1};
plot(x1,y,'*b')
hold on
end
hold off

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by