- Do you receive warning and/or error messages? If so the full and exact text of those messages (all the text displayed in orange and/or red in the Command Window) may be useful in determining what's going on and how to avoid the warning and/or error.
- Does it do something different than what you expected? If so, what did it do and what did you expect it to do?
- Did MATLAB crash? If so please send the crash log file (with a description of what you were running or doing in MATLAB when the crash occured) to Technical Support so we can investigate.
Create Categorical array for histogram on R2020a
3 views (last 30 days)
Show older comments
A = [0 0 1 1 1 0 0 0 0 NaN NaN 1 0 0 0 1 0 1 0 1 0 0 0 1 1 1 1];
C = categorical(A,[1 0 NaN],{'yes','no','undecided'})
h = histogram(C,'BarWidth',0.5)
does not work on 2020a.
Any workaround?
0 Comments
Answers (1)
Steven Lord
on 20 Jul 2022
I tried running those three lines of code in release R2020a and it produced the categorical histogram plot that I expected.
What does "does not work" mean in this context?
1 Comment
Bruno Luong
on 20 Jul 2022
Edited: Bruno Luong
on 20 Jul 2022
Steve when I run OP code on my laptop I get this on the command window (R2022a, Windows 11, Intel Irish XE Graphic card, latest driver installed)
h =
Histogram with properties:
Data: [no no yes yes yes no no no no undecided undecided yes no no no yes no … ]
Values: [11 14 2]
NumDisplayBins: 3
Categories: {'yes' 'no' 'undecided'}
DisplayOrder: 'data'
Normalization: 'count'
DisplayStyle: 'bar'
FaceColor: 'auto'
EdgeColor: [0 0 0]
Show all properties
Dot indexing is not supported for variables of this type.
Error in matlab.graphics.controls.internal.ToolbarButtonRegistry/getButtonIcon
Error in matlab.graphics.controls.AxesToolbarButton/setStandardIcon
Error in matlab.graphics.controls.AxesToolbarButton/set.Icon
Error in matlab.graphics.controls.AxesToolbarButton
Error in matlab.ui.controls.ToolbarPushButton
Error in matlab.graphics.controls.internal.PostUpdatePlugin.doCacheLoad
Error in matlab.graphics.controls.internal.PostUpdatePlugin>@()matlab.graphics.controls.internal.PostUpdatePlugin.doCacheLoad(canvasParent)
I works fine however if I do this before (may be a work around for OP)
opengl software
on other PC with different (Nvidia graphic card).
Odd and I have no ideat what to chase.
See Also
Categories
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!