RELFILE(FILE,PATH) converts full filename FILE to a relative filename with respect to PATH.
REL2FULLFILE(RELFILE,PATH) converts relative filename RELFILE to full filename using PATH as the base path.
Examples:
relfile('C:\Program Files\MATLAB\R2009a\bin\matlab.exe','C:\Program Files\MATLAB\R2009a')
returns '.\bin\matlab.exe' and
rel2fullfile('.\bin\matlab.exe','C:\Program Files\MATLAB\R2009a')
gets the original path back.
relfile('C:\Program Files\MATLAB\R2009a\bin\matlab.exe','C:\Program Files\MATLAB\R2009a\toolbox\matlab')
returns '..\..\bin\matlab.exe' and
rel2fullfile('..\..\bin\matlab.exe','C:\MATLAB\toolbox\matlab')
expands to 'C:\MATLAB\bin\matlab.exe'
Note on OS Compatibility:
Although these functions are written to be OS independent, they have been only tested under Windows. Please report here if you successfully used these functions under Linux or Mac.
|