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 CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by