Plot Matrices stored in Cell Array
6 次查看(过去 30 天)
显示 更早的评论
I have a 1by2 cell array that has the following elements
C{1}= [ 1 2 3 4 5 6]
C{2}= [987 877 77 666 777 66 77 ]
I want to plot these matrices C{1} and C{2} on the same graph.
Pleas help.
0 个评论
采纳的回答
Ameer Hamza
2020-3-7
You can plot elements of a cell array on the same graph by holding the axes. For example,
C{1} = [1 2 3 4 5 6];
C{2} = [987 877 77 666 777 66 77];
fig = figure();
ax = axes();
hold(ax);
for i = C
plot(i{:});
end
7 个评论
Ameer Hamza
2020-3-7
编辑:Ameer Hamza
2020-3-7
You can get the index of last element using this
cellfun(@(x) numel(x), C)
更多回答(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!