Why won't matlab plot data from a table?

3 Ansichten (letzte 30 Tage)
Daniel Montgomery
Daniel Montgomery am 21 Feb. 2020
Beantwortet: Rik am 21 Feb. 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 Kommentare
Sindar
Sindar am 21 Feb. 2020
It looks like y is a scalar value. Is that intentional?
Daniel Montgomery
Daniel Montgomery am 21 Feb. 2020
It is intentional.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Rik
Rik am 21 Feb. 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

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by