Filename in callback function

조회 수: 11 (최근 30일)
nilsotto
nilsotto 2016년 3월 17일
댓글: Adam 2016년 3월 17일
Hi,
How do I avoid running error if TSfile5 does not exist? See code below.
if true
[TSfile5,TSpath5]=uigetfile('*.txt','Select time signal file 5');
set(handles.TS5text,'String',TSfile5);
TSfile5=horzcat(TSpath5,TSfile5);
handles.TSfile5 = TSfile5;
guidata(hObject,handles)
end
if true
function RunButton_Callback(hObject, eventdata, handles)
TSfile5 = handles.TSfile5
end
  댓글 수: 1
Adam
Adam 2016년 3월 17일
That rather depends what you want to do in such a situation, what would cause it, whether it is a supported user action, should the user be told, etc, etc
In the code you have shown you aren't actually doing anything with the file.
uigetfile should not generally return files that don't exist so unless you delete the file between uigetfile and using it the file should be valid shouldn't it?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by