MatrixBerryCore
genfilename.m
Go to the documentation of this file.
1 function fileName = genfilename(inpStr)
2 ILLEGAL_CHARACTER_LIST = { '/', '\n', '\r', '\t', '\f', '`', '?', '*', '\\', '<', '>', '|', '\"', ':' };
3 illegalCharList=cellfun(@sprintf,ILLEGAL_CHARACTER_LIST,'UniformOutput',false);
4 isBadCVec=cellfun(@(x)(inpStr==x),illegalCharList,'UniformOutput',false);
5 isBadMat=vertcat(isBadCVec{:});
6 isBadVec=any(isBadMat,1);
7 fileName=inpStr;
8 fileName(isBadVec)='_';
function genfilename(in inpStr)
GENFILENAME generates a valid file name based on a given string.