Error when using histogram2: array is wrong shape or size

2 vues (au cours des 30 derniers jours)
Gustavo Araújo Rodríguez
Commenté : Tommy le 30 Avr 2020
Hello,
I have the following 1-by-9 vectors representing the bin edges of a bivariate histogram:
DIST_BINS = [0 5 10 20 30 50 100 200 1000];
MAG_BINS = [5.00 5.50 6.00 6.50 7.00 7.50 8.00 8.50 9.00];
I also have a 8-by-8 matrix with the bin counts:
DEAG_MATRIX = [ 0 0 0 0 0 0 0 0;
0 0 0 0 0 0 0 0;
0.0594 0.0485 0.0418 0.1706 0.0659 0.0039 0 0;
0 0 0 0 0 0 0 0;
0.0016 0.0029 0.0046 0.0250 0.0192 0.0067 0 0;
0 0 0.0000 0.0006 0.0006 0.0002 0 0;
0 0 0.0841 0.1712 0.1667 0.0109 0.0464 0.0683;
0 0 0 0.0001 0.0003 0.0000 0.0005 0.0000];
DEAG_MATRIX = round(DEAG_MATRIX*100)
When I try to use histogram2, I get the following error:
histogram2('XBinEdges',DIST_BINS,'YBinEdges',MAG_BINS,'BinCounts',DEAG_MATRIX)
Warning: Error creating or updating Quadrilateral
Error in value of property ColorData
Array is wrong shape or size
Warning: Error creating or updating Quadrilateral
Error in value of property ColorData
Array is wrong shape or size
Warning: Error creating or updating Quadrilateral
Error in value of property ColorData
Array is wrong shape or size
What am I doing wrong?
My version is MATLAB R2019b
  3 commentaires
Gustavo Araújo Rodríguez
It did not show any plot. However, I think I found the problem. I had created first an axes object and apparently MATLAB was trying to plot the histogram there. I added figure at the beginning and it worked.
Tommy
Tommy le 30 Avr 2020
Oh awesome!

Connectez-vous pour commenter.

Réponses (0)

Produits


Version

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by