I am trying to understand some m-files I find on this forum, but am stumped a bit by some of the strings statements used. Below are a few snippets that come from deploypcode by Sven.
Example 1:
function inPath = getFullPathStr(inPath) % Tricky little function that returns the fully qualified path by looking for filesep
inPath = fullfile(inPath); if ~any(regexp(inPath,['^(\w:)?\' filesep])) inPath = fullfile(pwd, inPath); endend
Example 2:
mustIgnoreList = {'^\.$','^\.\.$',[mfilename '.m']}; tmp = {'\.dll$'}
My questions
- Why is fullfile not sufficient to get the full file path, why does Sven need to check with the following regexp function?
- How do I interpret '^(\w:)?\' ?
- In example 2, how do I interpret {'^\.$','^\.\.$',[mfilename '.m']} ? I understand he is concatenating chars, but what does the '^\.$' mean exactly?
- In {'\.dll$'}, what does the ending with a $ imply?
Thanks
Best Answer