Plot multiple data in one plot using for loop

1 回表示 (過去 30 日間)
Hamidreza Esmalifalk
Hamidreza Esmalifalk 2019 年 2 月 17 日
編集済み: madhan ravi 2019 年 2 月 17 日
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 件のコメント
madhan ravi
madhan ravi 2019 年 2 月 17 日
please upload your data as .mat file

サインインしてコメントする。

採用された回答

madhan ravi
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
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 Exchange2-D and 3-D Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by