Filter löschen
Filter löschen

Parfor loop for saving data

1 Ansicht (letzte 30 Tage)
Alejandro Fernández
Alejandro Fernández am 18 Apr. 2020
Kommentiert: Sindar am 22 Apr. 2020
Hi, I needed to know if the next loop can be implemented using a parfor, because if I do that I get an error.
What I need is to store in the first column the time, in the second the psnr and in the third in snr for each of the 4 images.
Z = zeros(50,3,4);
parfor idx = 1 : 4
I = cargarDatos(idx);
for noise = 1 : 100
if isequal(mod(noise,2),1)
tic
J = medfilt2(I,[noise noise])
Z(r,1,idx) = toc;
[Z(r,2,idx),Z(r,3,idx)] = psnr(J,I4);
r = r + 1;
end
end
end
The "cargarDatos" function allows to upload the images in question
  3 Kommentare
Alejandro Fernández
Alejandro Fernández am 20 Apr. 2020
Yes you are right, I forgot to define r in the loop, but it still doesn't work, it still gives me error
Z = zeros(50,3,4);
parfor idx = 1 : 4
I = cargarDatos(idx);
r = 1;
for noise = 1 : 100
if isequal(mod(noise,2),1)
tic
J = medfilt2(I,[noise noise])
Z(r,1,idx) = toc;
[Z(r,2,idx),Z(r,3,idx)] = psnr(J,I4);
r = r + 1;
end
end
end
Sindar
Sindar am 22 Apr. 2020
what error?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Parallel for-Loops (parfor) finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by