How to vectorize histogram of rows in a matrix?
2 次查看(过去 30 天)
显示 更早的评论
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
2020-10-27
This is probably the fastest way. Any other method will likely make it slower and more complicated.
回答(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!