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!