[問題] GUI介面 listbox讀檔 ?已回收

看板MATLAB作者 (aloha)時間15年前 (2010/03/30 15:05), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
我會讓使用者key in 需要讀取檔案的路徑(ex: D:\) 然後 我利用ListBox 把該路徑下的檔案都顯示在上面 然後 執行 使用者選取的檔案(通常是圖檔) 我是follow 下面matlab網站去做 http://0rz.tw/UpFaO 目前 使用者輸入路徑後 已經可以將路徑下的所有檔案顯示在listbox內 但是 要點擊 然後直接開啟圖檔於axes時 ,就是不能work.... 會出現這樣的錯誤 Undefined function or method 'Gui_image' for input arguments of type 'struct'. Error in ==> guidemfile>@(hObject,eventdata)Gui_image('Original_image_file_Callback',hObject,eventdata,guidata(hObject)) ??? Error while evaluating uicontrol Callback 附上我的listbox 的callback code 有顏色的是我有改過的code get(handles.figure1,'SelectionType'); if strcmp(get(handles.figure1,'SelectionType'),'open') index_selected = get(handles.Original_image_file,'Value'); file_list = get(handles.Original_image_file,'String'); filename = file_list{index_selected}; if handles.is_dir(handles.sorted_index(index_selected)) cd (filename) load_listbox(pwd,handles) else [path,name,ext] = fileparts(filename); switch ext case '.jpg' axes (handles.axes1) imshow(filename); otherwise try % Use open for other file types. open(filename) catch ex errordlg(... ex.getReport('basic'),'File Type Error','modal') end end end end 請各位高手幫忙一下 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 140.112.174.25
文章代碼(AID): #1BiQAXJp (MATLAB)
文章代碼(AID): #1BiQAXJp (MATLAB)