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

convert.m
%
% invertigate converting a MATLAB documented m file to my format
%
close all;
clear;
setUpGraphics;
%
fObj = RequiredFilesClass();
%
if fObj.mName ~= 0
    fObj.mFile = readInTextFile( fObj.mPath, fObj.mName );
end
%
[mCells, noCells] = mFileCells( fObj.mFile );
%
% replace the headers
%
generatedFile = fObj.mFile;
for k = 1:noCells
    generatedFile = addSectionAt( generatedFile, mCells(k,1) + k - 1);
end;
%
writeOutFile( generatedFile,fObj.mPath, ['Temp',fObj.mName] );
%
fObj.mFile = readInTextFile( fObj.mPath, ['Temp',fObj.mName] );
%
% Analyze each cell and convert
%
[mCells, noCells] = mFileCells( fObj.mFile );
%
finalFile = [];
for k=1:noCells
    % process each cell
    cellStart = mCells(k,1);
    cellEnd = mCells(k,2);
    cellLines = fObj.mFile( cellStart : cellEnd );
    cellLines = convertCellLines( cellLines );
    finalFile = [finalFile; cellLines];
end;
%
writeOutFile( finalFile ,fObj.mPath, ['Converted',fObj.mName] );

Contact us