필터 지우기
필터 지우기

How can I name different plots?

조회 수: 1 (최근 30일)
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017년 10월 25일
댓글: MAHMOUD ALZIOUD 2017년 10월 27일
hello Everyone ,
I draw a lot of monthly data plot by a for loop from 1 to K, and each plot depends on the inputs from every month. I want to make a statement in each plot saying (This Month is 1, OR 2 or etc.). how can I please do that? the month variable in my code is called month and it is from 1 to 12.
  댓글 수: 2
KSSV
KSSV 2017년 10월 26일
How many plot you have K number of plots?
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017년 10월 26일
I have 12 plots, each plot represents one month in the year, so K is 12 please

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

채택된 답변

KSSV
KSSV 2017년 10월 27일
months = {'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','sep','oct','Nov','Dec'} ;
for i = 1:12
data = rand(10,1) ;
h(i) = figure ;
plot(data) ;
title(months{i}) ;
end
  댓글 수: 2
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017년 10월 27일
thank you very much for the answer, i will try it tomorrow and i will let you know what happened. best regards
MAHMOUD ALZIOUD
MAHMOUD ALZIOUD 2017년 11월 8일
편집: MAHMOUD ALZIOUD 2017년 11월 8일
Dear Mr KSSV, I have two cards, one for january and one for july, the months then must be 1 and 7. I wrote this code in order to plot a histogram for each card with the suitable title, how can I please index the variable TandLoad so I can have two histograms with each card data in each histogram? Note that K here is 2 because I have 2 cards just. when i run this code it gives me the histogram for july twice !! where is january one?
for K = 1 : length(directory)
filename = directory(K).name;
xtn1=Class9_data(:,15)*0.1*3.28084; %distance between A & B in ft
Tand1= Class9_data(xtn1(:,1)>3.28 & xtn1(:,1)<8 , :);
xtn2=Class9_data(:,17)*0.1*3.28084; %distance between B & C in ft
Tand2 = Class9_data(xtn2(:,1)>3.28 & xtn2(:,1)<8 , :);
xtn3=Class9_data(:,19)*0.1*3.28084; %distance between C & D in ft
Tand3 = Class9_data(xtn3(:,1)>3.28 & xtn3(:,1)<8 , :);
xtn4=Class9_data(:,21)*0.1*3.28084; %distance between D & E in ft
Tand4 = Class9_data(xtn4(:,1)>3.28 & xtn4(:,1)<8 , :);
TandemData=[Tand1;Tand2;Tand3;Tand4];
TandemLoad=[100*(Tand1(:,14)+Tand1(:,16));100*(Tand2(:,16)+Tand2(:,18));100*(Tand3(:,18)+Tand3(:,20));100*(Tand4(:,20)+Tand4(:,22))]; %it is multiplied by 100 because the units of weight are 100 kgm
figure
histogram(TandemLoad)
months = unique(Ans_7 (K)) ;
xlabel('Weight in Kg')
ylabel('Counts')
title(['ALS for C9 Tandem For Month ',num2str(months)])
end

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by