Make histogram from multiple cells.

3 vues (au cours des 30 derniers jours)
Marcus Johnson
Marcus Johnson le 21 Mar 2024
Hello,
I have a 1x30 cell array with all cells being Mx24 (M differ).
The cells look like the one above but with different amount of rows.
Now to my question, is there an efficient way to make one histogram of all of the values in all of the cells and not just a histogram for each cell?. I know that I can use cat to combine the cells and then make a histogram of the combined array, but I was wondering if there is a more efficient of doing it.
  1 commentaire
Stephen23
Stephen23 le 21 Mar 2024
CAT or VERTCAT

Connectez-vous pour commenter.

Réponse acceptée

Bruno Luong
Bruno Luong le 21 Mar 2024
% Generate dummy test data
C=arrayfun(@(varargin)randn(5+randi(20),24), 1:30, 'unif', 0);
A=cell2mat(C(:)); % m x 24, like cat(1,C{:})
histogram(A(:))

Plus de réponses (0)

Catégories

En savoir plus sur Data Distribution Plots dans Help Center et File Exchange

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by