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.
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)?
Thanks for these excellent videos. However, I am having some problems. I am trying to use the uigetfile to load a matfile without a .mat extension into the matlab workspace. I have had no problem doing this using the simple line:
load 18-dots.nirs -mat;
however, when I try this with the uigetfile I keep on getting error messages.
“??? Error using ==> load
Number of columns on line 1 of ASCII file C:\Documents and Settings\ft20\Desktop\Matlab Scripts for Nirs\Insert
Stim Marks\22-dots_fixed.nirs
must be the same as previous lines.”
and for the second I get:
“??? Error using ==> load
Unable to read file fileName: No such file or directory.”
Thanks,
F
Leave a Reply
About
Doug Hull is a proud MathWorker who is on a mission to help you with MATLAB.
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
Eli, does this help?
Cheers
Bob
Thanks for these excellent videos. However, I am having some problems. I am trying to use the uigetfile to load a matfile without a .mat extension into the matlab workspace. I have had no problem doing this using the simple line:
however, when I try this with the uigetfile I keep on getting error messages.
The scripts I have tried are:
fileName = uigetfile('*.nirs') load(fileName) -mat;or
fileName = uigetfile('*.nirs') load fileName -mat;Help is appreciated.
Cheers,
F
@Fredrik,
What are the error messages?
Doug
Doug,
the error message I get for the first script is:
“??? Error using ==> load
Number of columns on line 1 of ASCII file C:\Documents and Settings\ft20\Desktop\Matlab Scripts for Nirs\Insert
Stim Marks\22-dots_fixed.nirs
must be the same as previous lines.”
and for the second I get:
“??? Error using ==> load
Unable to read file fileName: No such file or directory.”
Thanks,
F