how to finish first part then second part in for loop?
Mostra commenti meno recenti
Hello all,
I have a for loop, and there are two parts. I want the part to complete then excute the second part in one for loop.
Basically I get all images files in one folder (many subfolders). I want to delete the images which the pixel values are less than 40 as well as all the images in the subfolder.
The script I wrote cannot delete all images which were in the same subfolder.
Thanks for your input!
S = dir(fullfile(path,'*.'));
N = setdiff({S([S.isdir]).name},{});
for ii = 1:numel(N)
T = dir(fullfile(path,N{ii},'*.tif'));
C = {T(~[T.isdir]).name};
for jj = 1:numel(C)
F = fullfile(path,N{ii},C{jj});
%first part
I=imread(F);
imwrite(I,['Z:\Cell_' num2str(ii) '_' num2str(jj) '.TIF']);
pixelvalue=size(I);
k=nnz(pixelvalue>=40);
%second part
if k==1 || k==0
delete(['Z:\Cell_' num2str(ii) '*.TIF']);
end
end
end
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Image Filtering in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!