Home > matlabmk > pathNname.m

pathNname

PURPOSE ^

function [justpath, justname]=pathNname(full_file)

SYNOPSIS ^

function [justpath, justname]=pathNname(full_file)

DESCRIPTION ^

function [justpath, justname]=pathNname(full_file)

 Splits a string specifiying a file name and its path into two
 strings (one for just the filename and one for just the
 path). For some reason EEGLAB wants the two separate when
 importing data.

 Input:
  full_file = a string specifying a file name and its path

 Outputs:
  justpath = a string containing just the path part of full_file
  justname = a string containing just the file name part of full_file

 Example: 
 >> setfile='/homes/dgroppe/MK2MAT/tryRT.set';
 >> [jpath, jname]=pathNname(setfile);

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [justpath, justname]=pathNname(full_file)
0002 %function [justpath, justname]=pathNname(full_file)
0003 %
0004 % Splits a string specifiying a file name and its path into two
0005 % strings (one for just the filename and one for just the
0006 % path). For some reason EEGLAB wants the two separate when
0007 % importing data.
0008 %
0009 % Input:
0010 %  full_file = a string specifying a file name and its path
0011 %
0012 % Outputs:
0013 %  justpath = a string containing just the path part of full_file
0014 %  justname = a string containing just the file name part of full_file
0015 %
0016 % Example:
0017 % >> setfile='/homes/dgroppe/MK2MAT/tryRT.set';
0018 % >> [jpath, jname]=pathNname(setfile);
0019 %
0020 
0021 
0022 justname='';
0023 justpath='';
0024 n=length(full_file);
0025 
0026 flg=0;
0027 for a=n:-1:1,
0028   if (flg==0) && (full_file(a)~='/')
0029     justname=[full_file(a) justname];
0030   else
0031     if full_file(a)=='/'
0032       flg=1;
0033     end
0034     justpath=[full_file(a) justpath];
0035   end
0036 end
0037

Generated on Tue 10-May-2016 16:37:45 by m2html © 2005