필터 지우기
필터 지우기

Plotting a cell

조회 수: 2 (최근 30일)
Jared
Jared 2011년 11월 2일
I asked before about plotting a cell and need some clarification.
What I have is the ability to load up to 6 data files. Say I call the cell f, and it is frequency v. time. Data file 1 is stored in {1,1} and {1,2} which is (x1,y1), data file 2 is stored in {1,3} and {1,4} (x2,y2), etc, up to {1,11} and {1,12} (x6,y6).
I gather I can simply use:
plot(f{:})
As far as I can see, it automatically assumes column 1 is x1, column 2 is y1, 3 is x2, etc? Also, it will ignore empty columns?
How can I change the line style, marker type and color of each? I know how to do it when using multiple inputs in the plot command, but this is just 1 input.

채택된 답변

Walter Roberson
Walter Roberson 2011년 11월 2일
If your line style and marker and color can be represented using the standard short encoding such as 'r--o' then use triples, as if from executing
f{1} = x1;
f{2} = y1;
f{3} = linespec1; %eg., 'b--o'
f{4} = x2;
f{5} = y2;
f{6} = linespec2; %eg., 'r--s'
Then
plot(f{:})
However, if your specifications cannot be encoded in this form, such as if you wish to use a color other than 'b' 'c' 'g' 'k' 'm' 'r' 'w' 'y', then it is not possible to do everything in just one plot() call. In such a case, encode what you can in the f cell array, then
h = plot(f{:});
Then set() the properties of the lineseries handles returned:
set(h(1), 'Color', [0.2 .8 .5]) %example
set(h(2), 'Color', 'g'); %example

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Line Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by