- #1
jaclyn89
- 5
- 0
hi, i am facing some problem when i want to display several output in a listbox.
i have 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. when i have 5 images' average<=10, then i should display 5 images name in the list box. but now my problem is, the current output will keep replace the previous output.
anyone can help me? 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 )
newText=sprintf('the percentage of diffrence for <<%s>> is %0.0f \n ',filename,aveg(k));
set(handles.listbox1,'String',newText);
else
set(handles.listbox1,'String','');
end
end
i have 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. when i have 5 images' average<=10, then i should display 5 images name in the list box. but now my problem is, the current output will keep replace the previous output.
anyone can help me? 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 )
newText=sprintf('the percentage of diffrence for <<%s>> is %0.0f \n ',filename,aveg(k));
set(handles.listbox1,'String',newText);
else
set(handles.listbox1,'String','');
end
end