Plotting a huge matrix
Mostrar comentarios más antiguos
I have a big matrix (Supply) with size of 21 X 1000,000 and I want to plot each column against a fixed time vector as
stairs(time, supply)
I have tried to do it with for loop and using the Apps tool box but it is taking forever to run. Is there a fast way to do it?
This is my for loop:
if true
for k = 1:size(supply,2)
stairs(time ,Supply(:,k)); hold on
disp([' ',num2str(k)])
end
Thanks,
2 comentarios
Adam
el 13 de Sept. de 2018
Are you sure you need to plot every value of those 1000000? There is no way that you can distinguish that many values on a plot. Indeed, at that level there aren't enough pixels on the screen to plot them all either. I would recommend sub-sampling your data and plotting that instead. I don't know off the top of my head what is a realistic number of samples to plot that you can visually distinguish, but it would be orders of magnitude less than that.
It could possibly be faster to store the output instead of plotting in each loop. The stairs function will not plot if two output arguments are specified
[x,y] = stairs([1 2 1],[1 2 1])
then you can just plot everything in one go
plot(x,y)
this way, no objects are created until you plot, so the loop should be much faster.
Respuesta aceptada
Más respuestas (2)
Yaser Khojah
el 13 de Sept. de 2018
0 votos
Yaser Khojah
el 14 de Sept. de 2018
Editada: Yaser Khojah
el 14 de Sept. de 2018
Categorías
Más información sobre Exploration and Visualization en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!