How i can publish help for more then one .m files simultaneously?
22 views (last 30 days)
Show older comments
I have more then 100 m files. Now i want to publish help for them. Publishing help for each individual will take a lot of time. But i want to publish help for all files simultaneously. so it saves my time. is there any way i can do this?
waiting for quick response.
thanks in advance.
3 Comments
Geoff Hayes
on 16 Jun 2014
You could write a script that would get a list of all your m files and then use the publish command on each file in that list. See http://www.mathworks.com/help/matlab/ref/publish.html for details.
Answers (1)
Marvin Clifford Feike
on 7 Nov 2023
Edited: Marvin Clifford Feike
on 7 Nov 2023
Just in case, I added a simple script, like it is suggested above.
You have to create a script "scriptPublishing.m", copy the code and execute it in your working directory, where you .m-files are located. It will generate a folder "latex" with the future .tex-files in it. Furhter options can be changed and additional options can turned on. The loop checks the folder for .m-files.
function scriptPublishing
close all; clear; clc;
% Publishing directory
mkdir latex
% Publishing options
options.format = 'latex';
options.outputDir = 'latex\';
options.evalCode = false;
options.catchError = false;
options.codeToEvaluate = false;
options.showCode = true;
% Publishing through folder
listing = dir;
[listingFiles,~] = size(listing);
for i = 1:listingFiles
mFileName = listing(i).name;
if exist(mFileName) == 2 % check if file with extension
[~,~,ext] = fileparts(mFileName);
if isequal(ext,'.m') % check if .m-file
publish(mFileName,options);
end
end
end
end
0 Comments
See Also
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!