How to plot each matrix in a cell?

6 ビュー (過去 30 日間)
Viet Duc
Viet Duc 2013 年 9 月 16 日
Hi everyone
I have a cell with size of 1x650 cell
And the size each matrix in the cell is 1x1300 double like this
A{n} = [1x1300 double] [1x1300 double] .... [1x1300 double]
Each matrix in the cell I have a graph
I want to plot all matrix in the cell into a figure
So how to plot the cell like this?

採用された回答

Simon
Simon 2013 年 9 月 16 日
Hi!
Create a figure, set it to "hold" (i.e. overwriting with subsequent plots) and plot
figure(1); cla; hold on;
cellfun(@(x) plot(x), A)
  3 件のコメント
Simon
Simon 2013 年 9 月 16 日
figure(1); cla; hold on;
h = cellfun(@(x) plot(x), A);
This gives you the handle of each plot, in your case a vector of 650 handles. "h(100)" corresponds to "A{100}" and so on.
Knowing the handle you may change almost everything in the figure
% change color
set(h(100), 'Color', 'k')
% get values of plot
get(h(100), 'YData')
For further reading: http://www.mathworks.com/help/matlab/plot-objects-1.html, look at "Lineseries Properties"
Viet Duc
Viet Duc 2013 年 9 月 16 日
Thank you very much
I got it.... :)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by