- 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
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Steven Lord
2022-7-20
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 个评论
Bruno Luong
2022-7-20
编辑:Bruno Luong
2022-7-20
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.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graphics Performance 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!