Plot multiple data in one plot using for loop
1 回表示 (過去 30 日間)
古いコメントを表示
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
採用された回答
madhan ravi
2019 年 2 月 17 日
編集済み: madhan ravi
2019 年 2 月 17 日
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 件のコメント
madhan ravi
2019 年 2 月 17 日
To check if each cell are same:
isequal(y{:}) % if returns one then they are all the same [resulting with just one plot]
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!