hi, i am facing some problem in my for loop or ifesle statement in matlab.(adsbygoogle = window.adsbygoogle || []).push({});

i used a for loop to load the images from a folder, after the images loaded, it will gone through some calculation to get the average. if the images average <=10, then i want to display the images name in a listbox. let say i have 10 images in my folder, and average for images' 2,4 and 6 is <=10, the images will still go through else statement. if the average of last image is <=10, it just will stop in if statement and wont go through else statement. anyone know what is the problem?

here is some part of my code:

sdirectory = 'D:\recognition system\database'; %specific the file directory

filess = dir([sdirectory '/*.png']);

for k = 1:length(filess)

filename = [sdirectory '\' filess(k).name];

I = imread(filename);

....

aveg(k)=abs((standev/mean1)*100);

if( aveg(k)<= 10 )

lo{k}=sprintf('%% of diffrence for <<%s>> is %G %%\n\n ',filename,aveg(k));

set(handles.listbox1,'String',lo);

else

set(handles.listbox1,'String','');

end

end

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# For loop in matlab

Loading...

Similar Threads for loop matlab |
---|

MATLAB MATLAB: forces acting on an object |

MATLAB Matlab histogram |

MATLAB Sovling Bernoulli's differential equation in matlab? |

Mathematica Looping through vectorized functions for a piecewise solution |

Mathematica While Loop in Mathematica |

**Physics Forums | Science Articles, Homework Help, Discussion**