Plot multiple data in one plot using for loop
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Hamidreza Esmalifalk
am 17 Feb. 2019
Bearbeitet: madhan ravi
am 17 Feb. 2019
I want to plot these 8 time series using for loop but it plots just the last one alone.
for i=1:8
plot(x,y{i},'LineWidth',2);
hold on
end
hold off
1 Kommentar
Akzeptierte Antwort
madhan ravi
am 17 Feb. 2019
Bearbeitet: madhan ravi
am 17 Feb. 2019
If you look the data in each cell closely infact they are all the same so all the plots overlap each other:
plot(x,[y{:}]) % you don't need a loop
1 Kommentar
madhan ravi
am 17 Feb. 2019
To check if each cell are same:
isequal(y{:}) % if returns one then they are all the same [resulting with just one plot]
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!