Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Displaying File path in GUI

Subject: Displaying File path in GUI

From: Travis

Date: 1 May, 2009 19:29:02

Message: 1 of 5

I am trying to make a GUI. Part of it involves impmporting files, and I would like to have something that displays the file path. So far I have the following...


function ExBrowse_Callback(hObject, eventdata, handles)
[FileEx,PathEx] = uigetfile('*.xls','Select the Emission Correction File');
ExPath = [PathEx FileEx];
handles.ExPath = ExPath;
guidata(hObject, handles);
end

function ExLoc_Callback(hObject, eventdata, handles)
ExPath = handles.ExPath;
disp(ExPath)
end

ExLoc is an editable text box. I have looked through the help files, and on the forums to no avail.

Subject: Displaying File path in GUI

From: Ahmet Mert

Date: 1 May, 2009 20:00:48

Message: 2 of 5

Try this:

function ExBrowse_Callback(hObject, eventdata, handles)
[FileEx,PathEx] = uigetfile('*.xls','Select the Emission Correction File');
ExPath = [PathEx FileEx];


set(handles.ExLoc,'String',ExPath) %% Your editable text box's tag should be "ExLoc" or you should change...

Subject: Displaying File path in GUI

From: Travis

Date: 1 May, 2009 23:07:01

Message: 3 of 5

Ahmet Mert <ahmettmert@yahoo.com> wrote in message <1338709.44630.1241208078778.JavaMail.jakarta@nitrogen.mathforum.org>...
> Try this:
>
> function ExBrowse_Callback(hObject, eventdata, handles)
> [FileEx,PathEx] = uigetfile('*.xls','Select the Emission Correction File');
> ExPath = [PathEx FileEx];
>
>
> set(handles.ExLoc,'String',ExPath) %% Your editable text box's tag should be "ExLoc" or you should change...

It didn't work

Subject: Displaying File path in GUI

From: Travis

Date: 2 May, 2009 01:32:02

Message: 4 of 5

Sorry for the complete lack of information. I have this now...


function ExBrowse_Callback(hObject, eventdata, handles)

[FileEx,PathEx] = uigetfile('*.xls','Select the Excitation Correction File');
ExPath = [PathEx FileEx];

handles.ExPath = ExPath;
guidata(hObject,handles);
set(handles.ExLoc,'String',ExPath);

Which, as far as I can tell, is the same as their example of...

function pushbutton2_Callback(hObject, eventdata, handles)

set(handles.textStatus, 'String', 'Picture button pushed')

With the exception of the text.

Subject: Displaying File path in GUI

From: Travis

Date: 3 May, 2009 01:54:02

Message: 5 of 5

"Travis" <sinusoid2@hotmail.com> wrote in message <gtg7qi$fbl$1@fred.mathworks.com>...
> Sorry for the complete lack of information. I have this now...
>
>
> function ExBrowse_Callback(hObject, eventdata, handles)
>
> [FileEx,PathEx] = uigetfile('*.xls','Select the Excitation Correction File');
> ExPath = [PathEx FileEx];
>
> handles.ExPath = ExPath;
> guidata(hObject,handles);
> set(handles.ExLoc,'String',ExPath);
>
> Which, as far as I can tell, is the same as their example of...
>
> function pushbutton2_Callback(hObject, eventdata, handles)
>
> set(handles.textStatus, 'String', 'Picture button pushed')
>
> With the exception of the text.

nevermind, a quick reset of MATLab fixed it, and it works great now.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us