From: Zulkifli on 23 Feb 2010 02:04 hi all i've a query here on what i've done wrong and i'm not sure where exactly the problem is. I build a gui and in the gui, there is a static text box and a pushbutton. when i press a pushbutton, it should come up with a text where i'm using set function. function pushbutton19_Gen_Bands_Callback(hObject, eventdata, handles) % hObject handle to pushbutton19_Gen_Bands (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) for z=1:20 %% Band 1 handles.thepath = 'C:\System\image files'; handles.jpegFiles = dir(fullfile(handles.thepath, '*.jpg')); for k = 1:length(handles.jpegFiles) if k==1 handles.filename=handles.jpegFiles(k).name; data1 = imread([handles.thepath filesep handles.filename]); data2=imcrop(data1,[1 1 1392 52]); imwrite(data2,'band1.JPG'); set(handles.text5_monitor,'String','band 1 created'); else break; end end %% Band 2 handles.thepath = 'C:\System\image files'; handles.jpegFiles = dir(fullfile(handles.thepath, '*.jpg')); for j = 1:length(handles.jpegFiles) if j==1 handles.filename=handles.jpegFiles(j).name; data1 = imread([handles.thepath filesep handles.filename]); data2=imcrop(data1,[1 53 1392 52]); imwrite(data2,'band2.JPG'); set(handles.text5_monitor,'String','band 2 created'); else break; end end The problem raise is that when it run, it only use display >>band 1 created it did't display band 2 created. infact it come up with an error saying ??? Reference to non-existent field 'text5_monitor'. what i did it wrong?
|
Pages: 1 Prev: Raytracing for a 3-D structure Next: Re-arranging symbolic equations |