i wanted to plot histogram for following

2 views (last 30 days)
status = [dosing, dosing, dosing, initializing, dosing, dosing, initializing];
I wanted to plot graph like this:

Accepted Answer

Nobel Mondal
Nobel Mondal on 8 Jun 2015
Edited: Nobel Mondal on 8 Jun 2015
% Need to convert the input as a cell-array
>> status = {'dosing', 'dosing', 'dosing', 'initializing',...
'dosing', 'dosing', 'initializing'};
>> [count,states] = grp2idx(status);
>> hist(count,unique(count));
>> set(gca,'xTickLabel',states)

More Answers (0)


Find more on Data Distribution Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!