Plot a structure array without a loop
9 次查看(过去 30 天)
显示 更早的评论
I ran a Monte-Carlo with 300 simulation runs and I stored the output data for each run in a structure as
DATA(i).x = outputX;
DATA(i).y = outputY;
.Now I want to plot the data in a figure for all iterations without iterating through a loop. For now, I'm using
figure(1);hold on;grid on;box on;
for i = 1:n
plot(DATA(i).x,DATA(i).y,'.-')
end
hold off;
Is it possible to plot all the data as
plot(DATA(:).x,DATA(:).y,'.-');
or do I have to use commands like struct2cell and then cell2mat for this?
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!