Make histogram from multiple cells.
4 ビュー (過去 30 日間)
古いコメントを表示
Hello,
I have a 1x30 cell array with all cells being Mx24 (M differ).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1648191/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1648196/image.png)
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.
採用された回答
Bruno Luong
2024 年 3 月 21 日
% 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(:))
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!