File Exchange Pick of the Week

September 27th, 2007

MATLAB Basics video: UIGETFILE for selecting a file in a script, function or GUI

This is one in a series of videos covering MATLAB basics. It is meant for the new MATLAB user.

This video covers how to use UIGETFILE to make it easier to select a file from a script, function or GUI.

Video Content

Find the files here.

Other videos have been gathered here:
http://blogs.mathworks.com/pick/category/video/

Other MATLAB Basics posts have been gathered here:
http://blogs.mathworks.com/pick/category/matlab-basics/

4 Responses to “MATLAB Basics video: UIGETFILE for selecting a file in a script, function or GUI”

  1. Eli replied on :

    Say I use uigetfile to get a filename that is in a path not currently part of the matlab path. When I execute the next line of code (load(fileName)), the file will not be loaded since it is not in the current path. How can I go about adding the path (automatically/ without additional user input)?

    Cheers,
    Eli

  2. Bob replied on :

    Eli, does this help?

      [f,p] = uigetfile;
      load(fullfile(p,f))
    

    Cheers
    Bob

  3. Andreas Kaipanos replied on :

    i’m having a problem when using uigetfile in a gui i developed…i have created a pushbutton and in it i have writen:
    function pushbutton2_Callback(hObject, eventdata, handles)
    % hObject handle to pushbutton2 (see GCBO)
    % eventdata reserved – to be defined in a future version of MATLAB
    % handles structure with handles and user data (see GUIDATA)
    data5=importdata(uigetfile(‘*’));
    dd=length(data5(:,1));

    and it just doesn’t work

  4. Doug replied on :

    @Andreas,

    What file are you selecting?

    If you uigetfile the name of the file directly does it work? What is the error message?

Leave a Reply

Wrap code fragments inside <pre> tags, like this:

<pre class="code">
a = magic(3);
sum(a)
</pre>

If you have a "<" character in your code, either follow it with a space or replace it with "&lt;" (including the semicolon).


MathWorks

Brett & Jiro share their favorite user-contributed submissions from the File Exchange.

These postings are the author's and don't necessarily represent the opinions of The MathWorks.