Code covered by the BSD License  

Highlights from
publish2latex

image thumbnail

publish2latex

by

 

09 Apr 2013 (Updated )

Using full Latex markup in m-files to generate high quality documentation. Version 1.3

charArray2cells( stringArray, eolChar )
function charCells = charArray2cells( stringArray, eolChar )
%
% Purpose : Convert a character array to a cell array
%
% Author :  Matther Harker and Paul O'Leary
% Date :    29. Jan 2013
% Version : 1.0
%
% (c) 2013 Matther Harker and Paul O'Leary
% url: www.harkeroleary.org
% email: office@harkeroleary.org
%
% History:
%   Date:           Comment:
%

%
% Remove the special characters from the warning strings.
% this ino an ideal solution, but presently I do not have a better one.
% This porblem is associate with warning strings which contain special
% characters.
%
try
    inds = strfind( stringArray, '}' );
    if ~isempty( inds )
        stringArray(inds) = ' ';
        stringArray(inds + 1) = ' ';
    end;
catch me
end;
%
try
    inds = strfind( stringArray, '}' );
    if ~isempty( inds )
        stringArray(inds) = ' ';
        stringArray(inds + 1) = ' ';
    end;
catch me
end;
%
if ~isempty( stringArray )
    inds = strfind( stringArray, eolChar );
    if ~isempty( inds )
        noLines = length(inds);
        %
        charCells = cell(noLines,1);
        line = stringArray( 1:inds(1));
        charCells{1} = line;
        for k=2:noLines
            line = stringArray( inds(k-1) + 1: inds(k));
            charCells{k} = line;
        end;
    else
        charCells = cell(1,1);
        charCells{1} = stringArray;
    end;
else
    charCells = [];
end;

Contact us