0
votes

I tried this code to get a categorical label on the bottom of my bar graph:

c = categorical({'apples','oranges','pears'});
prices = [1.23 0.99 2.3];
bar(c,prices)

In the MATLAB documentation, this claims to have the bottom of the axis labelled with the categories in c. Instead I only see 1, 2, 3 along the bottom. Is something wrong with my setup?

1
@SardarUsama true, it is. Thanks for showing this. Still, that post doesn't have a good explanation of why the function isn't working as shown in MATLAB's documentation; rather it has a workaround suggestion instead. Any ideas on why it doesn't work this way?teepee
Read the documentation of the version that you actually have. Not sure about R2016b, but what you're trying to do wasn't introduced till R2016a.Sardar Usama
I am actually using R2016b, so I'm not sure why it won't work.teepee
Do you see that code in the documentation of R2016b?Sardar Usama

1 Answers

1
votes

This functionality was only introduced in Matlab 2017a. As you can see here it is absent from 2016b docs:

enter image description here