How to vectorize histogram of rows in a matrix?

2 visualizaciones (últimos 30 días)
Jay
Jay el 27 de Oct. de 2020
Comentada: Ameer Hamza el 27 de Oct. de 2020
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 comentario
Ameer Hamza
Ameer Hamza el 27 de Oct. de 2020
This is probably the fastest way. Any other method will likely make it slower and more complicated.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Histograms en Help Center y File Exchange.

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by