How to vectorize histogram of rows in a matrix?

2 ビュー (過去 30 日間)
Jay
Jay 2020 年 10 月 27 日
コメント済み: Ameer Hamza 2020 年 10 月 27 日
Is there any way to vectorize the following where it doesn't use the for loop?
rows = 5;
cols = 20;
z = randn(rows, cols);
for i = 1:size(z,1)
figure;
histogram(z(i,:))
title(['Histogram of row ',num2str(i)]);
xlabel('Bins');
ylabel('Frequency');
end
  1 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 10 月 27 日
This is probably the fastest way. Any other method will likely make it slower and more complicated.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeHistograms についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by