Home > eeg > egis > misc_utils > get_fid.m

get_fid

PURPOSE ^

function [fid,fname,pathname]=get_fid(perm, mask, title)

SYNOPSIS ^

function [fid,fname,pathname]=get_fid(perm, mask, title)

DESCRIPTION ^

function [fid,fname,pathname]=get_fid(perm, mask, title)

This function prompts for a filename and pathname using the ui.
It check first to see if a non-null string is returned from the ui.
If a valid filename is entered, the function attempts to open the
file with the specified permission, and returns a fid and 
pathname+filename string.

Argument perm is a file permission string (c.f. fopen). Arguments
mask and title are passed to uigetfile (c.f.).

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [fid,fname,pathname]=get_fid(perm, mask, title)
0002 %function [fid,fname,pathname]=get_fid(perm, mask, title)
0003 %
0004 %This function prompts for a filename and pathname using the ui.
0005 %It check first to see if a non-null string is returned from the ui.
0006 %If a valid filename is entered, the function attempts to open the
0007 %file with the specified permission, and returns a fid and
0008 %pathname+filename string.
0009 %
0010 %Argument perm is a file permission string (c.f. fopen). Arguments
0011 %mask and title are passed to uigetfile (c.f.).
0012 %
0013 
0014 % Modification history:
0015 % 01/22/96 PJ Added pathname to argout list
0016 
0017 if nargin < 1
0018     error('Function requires a file permision string as the first argument.');
0019 elseif nargin == 1
0020     mask='*.*';
0021     title='Open File:';
0022 elseif nargin == 2
0023     title='Open File:';
0024 end
0025 
0026 [fname, pathname] = uigetfile(mask,title);
0027 if isempty(fname)
0028    fid= -1;
0029    disp('No filename selected. You have to click on a name')
0030    return;
0031 end
0032 
0033 fname = [pathname fname];
0034 
0035 [fid, message]=fopen(fname,perm);
0036 if fid == -1
0037   disp(message)
0038 end
0039 
0040 
0041 
0042

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003