Azzera filtri
Azzera filtri

Create Categorical array for histogram on R2020a

1 visualizzazione (ultimi 30 giorni)
It seems like this example on Histogram plot - MATLAB - MathWorks Italia :
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?

Risposte (1)

Steven Lord
Steven Lord il 20 Lug 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?
  • 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.
  1 Commento
Bruno Luong
Bruno Luong il 20 Lug 2022
Modificato: Bruno Luong il 20 Lug 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.

Accedi per commentare.

Categorie

Scopri di più su Graphics Performance in Help Center e File Exchange

Prodotti


Release

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by