Grouping the bar graph
2 ビュー (過去 30 日間)
古いコメントを表示
Hello, I wrote following lines for plotting a bar graph of shock1-shock5 excel files.
%filename='shock1-5.xlsx'
clear all
clc
training=5;
sheetname='Result';
for i=1:training
disp(i)
freezePercent=xlsread(strcat('shock',num2str(i)),'C2:C11');
for j=1:length(freezePercent)
bar(freezePercent,'grouped')
hold on
end
end
However my code returns me stacked bar graph which looks like this. 

I want mine to look like this:

0 件のコメント
採用された回答
Ameer Hamza
2020 年 6 月 1 日
Try this
clear all
clc
training=5;
sheetname='Result';
freezePercent = zeros(training, 10);
for i=1:training
freezePercent(i,:)=xlsread(strcat('shock',num2str(i)),'C2:C11');
end
bar(freezePercent)
6 件のコメント
Ameer Hamza
2020 年 6 月 2 日
Glad that you found the solution. You may also see subplot() to draw them on the same figure.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!