Home > eeg > egis > misc_utils > put_fid.m

put_fid

PURPOSE ^

function [fid,fname]=put_fid(perm,tempfilename, title)

SYNOPSIS ^

function [fid,fname]=put_fid(perm,tempfilename, title)

DESCRIPTION ^

function [fid,fname]=put_fid(perm,tempfilename, 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]=put_fid(perm,tempfilename, title)
0002 %function [fid,fname]=put_fid(perm,tempfilename, 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 if nargin < 1
0015     error('Function requires a file permision string as the first argument.');
0016 elseif nargin == 1
0017     tempfilename='*.*';
0018     title='Save As:';
0019 elseif nargin == 2
0020     title='Save As:';
0021 end
0022 
0023 [fname, pathname] = uiputfile(tempfilename,title);
0024 if (fname == '')|(fname == 0)
0025    fid= -1;
0026    disp('No filename selected. You have to click on a name')
0027    return;
0028 end
0029 
0030 fname = [pathname fname];
0031 
0032 [fid, message]=fopen(fname,perm);
0033 if fid == -1
0034   disp(message)
0035 end

Generated on Wed 20-Mar-2019 04:00:51 by m2html © 2003