Is there a way to vectorize operations such as plots (e.g. cwt()) on 2 dimensional matrices?

조회 수: 1 (최근 30일)
I am trying to efficiently create and save plots of each row of values from a [40000 x 256] matrix samplesMatrix as an image. Each row is a frame of sensor data. The corresponding class label for each frame is stored in ActID where each row entry corresponds to class label of each frame of sensor data. The main parts of the code are shown here. The only way I have implemented it thus far is using a for loop:
for i = 1:size(samplesMatrix,1)
cwt(samplesMatrix(i,:))
t = strcat('Scalogram ', '_', num2str(actID(i)), '_', num2str(i));
saveas(gcf, fullfile(destinationFolder, t), 'png')
With the for loop this implementation ends up taking hours. Is there a way of vectorizing an operation like this? Each image is saved to a folder based on the activity id, so the destinationFolder changes as well.
Is there a more efficient way of doing this? Is there a way of vectorizing operations such as plots?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Animation에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by