Azzera filtri
Azzera filtri

Change the name of the output file as a loop computes

2 visualizzazioni (ultimi 30 giorni)
Hello all,
What i want to do is create a stack of files... i have a function F(x,y,z) and it is set to run and calculate F at different z values something like:
for zloop=1:pixel_dimension;
z=zloop;
calculate the function based on x y and the changing z value F(x,y,z)
PSF=(abs(F)).^2;
% save images
imwrite(PSF, 'C:\Documents and Settings\User\My Documents\MATLAB\Deconvolution\Brenden\Deconvolution\Point Spread Function\PSF stack\ NAME .bmp', 'bmp');
end
What i want to know is how to change the name of the output file with each iteration so i dont "write over" the same file each time.

Risposta accettata

Paulo Silva
Paulo Silva il 14 Lug 2011
for zloop=1:pixel_dimension;
z=zloop;
calculate the function based on x y and the changing z value F(x,y,z)
PSF=(abs(F)).^2;
% save images
imwrite(PSF, ['C:\Documents and Settings\User\My Documents\MATLAB\Deconvolution\Brenden\Deconvolution\Point Spread Function\PSF stack\' num2str(zloop) '.bmp'], 'bmp');
end
  2 Commenti
Brenden
Brenden il 14 Lug 2011
can i add more to the name than just the number zloop?? like name it PSF(zloop)??
Paulo Silva
Paulo Silva il 14 Lug 2011
just be careful not to add something that the OS won't allow for file names
[path string1 string2 ...]

Accedi per commentare.

Più risposte (1)

the cyclist
the cyclist il 14 Lug 2011
As the file input, create a string with the file name. For example,
filename = ['file',num2str(zloop),''];

Categorie

Scopri di più su Images in Help Center e File Exchange

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by