How to correcty set this error??
1 次查看(过去 30 天)
显示 更早的评论
Hi everybody!! I have to set an error when I read a file.
My error box has to appear when users press "Load" before choosing the file.
I tried lots of combinations, but it doesn't work... It only shows me a textread error like:
??? Error using ==> textread at 167
File not found.
Error in ==> E1_Amm_IT>PB_Carica_Callback at 202
[anno azienda istituto disciplina_dimissione prog_reparto ...
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> E1_Amm_IT at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)E1_Amm_IT('PB_Carica_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
I post you my code:
function PB_Browse_Callback(hObject, eventdata, handles)
global file
[file path] = uigetfile('*.txt');
global filepath
filepath = strcat(path, file);
set(handles.ET_Path, 'String', filepath);
filename=get(handles.ET_Path, 'String');
global filepath;
if strcmp(filepath, '')==1
errordlg('Choose a file!', 'ERROR!');
elseif strcmp(filepath, '')==0
% My .m file runs
How can I fix it??
2 个评论
Walter Roberson
2012-1-19
We need to see the code for PB_Carica_Callback
Also, please read
http://matlab.wikia.com/wiki/FAQ#How_can_I_share_data_between_callback_functions_in_my_GUI.3F
采纳的回答
Walter Roberson
2012-1-19
Why don't you simply set PB_Carica 'enable' to 'off' until the browsing has been done?
更多回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Dialog Boxes 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!