How to correcty set this error??
1 view (last 30 days)
Show older comments
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 Comments
Walter Roberson
on 19 Jan 2012
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
Accepted Answer
Walter Roberson
on 19 Jan 2012
Why don't you simply set PB_Carica 'enable' to 'off' until the browsing has been done?
More Answers (1)
See Also
Categories
Find more on Dialog Boxes in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!