Doxygen Source Code Documentation
GetPath.m
Go to the documentation of this file.00001 function [err,p,f] = GetPath (s) 00002 % 00003 % [err,PathString,FileString] = GetPath (s) 00004 % 00005 %Purpose: 00006 % Breaks the string s into a path and file part 00007 % 00008 % 00009 %Input Parameters: 00010 % s is a string like How/Didley/Doo 00011 % 00012 % 00013 %Output Parameters: 00014 % err : 0 No Problem 00015 % : 1 Mucho Problems 00016 % 00017 % PathString is a string like How/Didley 00018 % FileString is a string like Doo 00019 % 00020 %More Info : 00021 % 00022 % 00023 % 00024 % 00025 % Author : Ziad Saad 00026 % Date : Thu Apr 23 11:41:06 CDT 1998 00027 00028 00029 %Define the function name for easy referencing 00030 FuncName = 'GetPath'; 00031 00032 %initailize return variables 00033 err = 1; 00034 p = ''; 00035 f = ''; 00036 00037 N = length(s); 00038 if (N == 0), 00039 err = ErrEval(FuncName,'Err_Emtpy string'); return; 00040 end 00041 00042 [i] = findstr(s,'/'); 00043 if (isempty(i)), 00044 p = ''; 00045 f = s; 00046 elseif (max(i)==N); 00047 p = s; 00048 f = ''; 00049 else 00050 p = s(1:max(i)); 00051 f = s(max(i)+1:N); 00052 end 00053 00054 00055 err = 0; 00056 return; 00057