Comments on: MATLAB Basics video: UIGETFILE for selecting a file in a script, function or GUI https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/?s_tid=feedtopost Stuart uses video to share his experiences solving problems with MATLAB day-to-day, interesting new features, plus tips and tricks he has picked up along the way. Mon, 04 Apr 2016 20:22:48 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: Stuart McGarrity https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-55539 Tue, 08 Sep 2015 15:12:14 +0000 https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-55539 Seems more of a file import issue now rather than a uigetfile issue. Could you say again what you want to read in? Could you give a sample of the file?

]]>
By: Iqbal https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-54985 Thu, 27 Aug 2015 02:53:24 +0000 https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-54985 Ok I try like this it works :

[newFile,newPath]=uigetfile(‘.txt’, ‘Select data file.’);
location=[newPath,newFile];

%pause (2)
dataku=dlmread(location,”,8,0)

but i want this data read in each lines. how do you do that??

]]>
By: Iqbal https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-54984 Thu, 27 Aug 2015 02:49:59 +0000 https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-54984 my text file is like this :

; ENVI Output of ROIs (4.4) [Wed Aug 19 10:18:04 2015]
; Number of ROIs: 1
; File Dimension: 212 x 204
;
; ROI name: EVF: Layer: 10 titik sampel.shp
; ROI rgb value: {0, 0, 0}
; ROI npts: 10
; ID X Y Lat Lon B1 B2
1 113 9 -6.904033 113.273571 0.0531 0.3688
2 68 13 -6.912415 113.179550 0.0505 0.4311

but i cant open using this script of your code using GUI :

function Open1_Callback(hObject, eventdata, handles)
fileName = uigetfile(‘*.txt’)

load fileName -txt;

I try to open like this but the error like this :

Error using load
Unknown command option.

Error in tes>Open1_Callback (line 102)
load fileName -txt;

Error in gui_mainfcn (line 96)
feval(varargin{:});

Error in tes (line 42)
gui_mainfcn(gui_State, varargin{:});

Error in
@(hObject,eventdata)tes(‘Open1_Callback’,hObject,eventdata,guidata(hObject))

Error while evaluating uicontrol Callback

Please help. any suggestion, i am using matlab 2013a. thanks

]]>
By: Iqbal https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-54983 Thu, 27 Aug 2015 02:43:17 +0000 https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-54983 Sorry i can’t open this video. please send me the videos to my email.

]]>
By: Sandeep https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-34665 Tue, 18 Mar 2014 14:59:49 +0000 https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-34665 I need help. When I use ‘uigetfile’ it takes me to the folder where I have save my GUI. I want to select the file from different folder. I can do this for the first time but when I again use ‘uigetfile’ it takes me again to the same folder where I saved my GUI. I do not want this. I want, in second time it takes me to the same folder from where I select my first file. How I can do this. Please help me. I am new to GUI. Help is appreciated.
cheers

]]>
By: Fabian Clemens https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-3018 Thu, 08 Mar 2012 14:10:24 +0000 https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-3018 I use uigetfile to locate a txt-file on the network (paths start with \\abd…). Once the file is selected, I’ll process it using textread:
pause on

[newFile,newPath]=uigetfile(‘.txt’, ‘Select data file.’);
location=[newPath,newFile];

%pause (2)
Data=textread(location);

I get the error message ‘Error using exist: The first input must be a string’ before the uigetfile even opens. I don’t get an error when i store the whole program on a local drive rather than on a network drive. I compiled the program to run as a standalone and saved it on network drive – same folder with MCR.
I’ve tried to pause between uigetfile and textread, but w/o success. Do i need to put something else in between? I even tried to remove ‘newPath’ from my file location to have it only look at the current folder: same error message.
It runs fine, when started as standalone and saved on local HD. It runs fine when started with Matlab (saved locally or on network). It does not run fine, when started as standalone and saved on network.

Any ideas?
Thank you,
Fabian

]]>
By: Fredrik https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-1680 Tue, 17 Nov 2009 20:42:57 +0000 https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-1680 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

]]>
By: dhull https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-1672 Fri, 13 Nov 2009 19:07:21 +0000 https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-1672 @Fredrik,

What are the error messages?

Doug

]]>
By: Fredrik https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-1671 Thu, 12 Nov 2009 17:30:11 +0000 https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-1671 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.

The scripts I have tried are:


fileName = uigetfile('*.nirs')

load(fileName) -mat;

or


fileName = uigetfile('*.nirs')

load fileName -mat;

Help is appreciated.

Cheers,

F

]]>
By: Bob https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-539 Thu, 05 Jun 2008 01:29:14 +0000 https://blogs.mathworks.com/videos/2007/09/27/matlab-basics-video-uigetfile-for-selecting-a-file-in-a-script-function-or-gui/#comment-539 Eli, does this help?

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

Cheers
Bob

]]>