How do i loop over multiple lines of codes?

Is this correct:
Gil=dir('C:/users/document/reut/*.jpg');
for u=1:150
Name=strcat('C:/users/document/reut/',Gil(u).names);
F=imread(Name)
[ca,ch,cv,cd]=dwt2(F,'haar');
Mi= mean(min(ca));
Mig= mean(min(cv));
xlswrite('Mi.xls', Mi)
xlswrite('Mig.xls',Mig)
end
This code intends to decompose several images from the path and Use the results to get Mi and Mig while it also extract these values of Mi and Mig for each of the images in the loop and save them in a .xls file. Mi and Mig taking two columns and their values for each image in rows without overwriting or interference.
But these codes are not working. Please help me. I am new to MATLAB

1 commentaire

So, what isn't working?
Couple minor stylistic points...
subdir='C:/users/document/reut'; % define as variable instead of duplicating text in line
Gil=dir(fullfile(subdir,'*.jpg')(); % fullfile() to build name from pieces
for u=1:numel(Gil) % iterate over the returned size instead of constant
Name=fullfile(subdir,Gil(u).name); % fullfile but field is .name (NOT plural .names)
...
Your code above will also overwrite the two .xls files each pass through when it does run leaving only the last pass.
What is expected output?

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Wavelet Toolbox dans Centre d'aide et File Exchange

Produits

Version

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by