How to Graph structures

조회 수: 3 (최근 30일)
Karl
Karl 2013년 5월 29일
I have just learned how to make structure variables. I have problems making graphs with these. The commands below makes 6 different figures with only one line, and with wrong x-axis (with "Alder). I wish to make only 1 figure, with 8 lines and x-axsis with "Aar". The structure variable gjG(x).Data, 1<=x<=8, consists of x 11x8 matrices. As you can see of my comands, I ony wish to draw data from the 11th row.
Alder = {'<20', '2029','3039','4049','5059','6069','>70', 'all'};
Aar = {'2011', '2012', '2013_1', '2014_1', '2014_s2', '2014_s5'};
nAar = length(Aar);
nAlder = length(Alder);
numberOfColors = nAlder;
myColorMap = lines(numberOfColors);
for iAar = 1:nAar;
figure;
hold on
for iAlder = 1:nAlder
plot(gjG(iAar).Data(11,:), 'color', myColorMap((iAlder), :));
legend((Alder),'location','NE','FontSize',10);
end
hold off
end

답변 (1개)

Iain
Iain 2013년 5월 29일
Move the figure command OUTSIDE the loop to only get 1 figure.
  댓글 수: 1
Karl
Karl 2013년 5월 29일
That helped getting 1 figure, but still there is 8 points for "Alder" on the x-axis and one line per "Aar". I want it the other way around: 6 points on the x-axis for "Aar" and 8 different lines for "Alder".

댓글을 달려면 로그인하십시오.

카테고리

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