How i can publish help for more then one .m files simultaneously?

35 views (last 30 days)
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
Mujhaid
Mujhaid on 15 Jun 2014
Yes my code has proper formatting i am just asking by simply clicking on publish button i can publish only help for one m file. But is there any way that i can publish help for more than one files simultaneously as publishing help for each single file will take a lot of time for publishing help for 1000 of m files.
Geoff Hayes
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.

Sign in to comment.

Answers (1)

Marvin Clifford Feike
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

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!