MLSTRIPCOMMENTSSTR Strip comments from a string with MATLAB code. OSTR = MLSTRIPCOMMENTSSTR(ISTR) takes the input string ISTR, assuming it contains MATLAB code, strips all MATLAB comments, and returns the result as the output string OSTR. The input string must be a row vector or a cell array of row vectors. Any input string may be a multi-line string, that is a string containing newline characters, for example a string containing the entire contents of an m-file. Example: Read all MATLAB code from an m-file opened for reading on file identifier "fid" and strip all comments: str = fread(fid); % data as numerical column vector str = char(str)'; % data as character row vector str = mlstripcommentsstr(str); % strip all MATLAB comments See also MLSTRIPCOMMENTSFILE, MLSTRIPCOMMENTSFID.