How to plot each matrix in a cell?

조회 수: 3 (최근 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 CenterFile Exchange에서 Creating, 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