bar graph inside loop

조회 수: 1 (최근 30일)
NETHRAVATHI S
NETHRAVATHI S 2021년 4월 5일
댓글: KSSV 2021년 4월 5일
for i = 1:4
enkwh=0;
data{i} = xlsread(filename11,i);
figure
PP=bar(data{i},'stacked');
xlabel('timeframe')
ylabel('loads')
title (sprintf('On status of loads before scheduling %d',i))
end
this is my code.
I am reading an excel file with 4 sheets in it.
When i am plotting, instead of 4 bar graphs i am getting 3 only
i=1 bar graph is not plotted.
i am getting only for i=2,3,4
can somebody tell me why it is happening
  댓글 수: 2
Matt J
Matt J 2021년 4월 5일
편집: Matt J 2021년 4월 5일
Possibly because the data{1} cell is empty or full of NaNs. It would be easier to assess if you attached a .mat file containing the data{} cell array generated by your code.
KSSV
KSSV 2021년 4월 5일
You need not to plut xlable, ylable inside the loop.....it may be pushed out of loop.

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by