Publish class method when using separate files

6 visualizzazioni (ultimi 30 giorni)
Bradley Treeby
Bradley Treeby il 12 Ott 2022
Risposto: Ishu il 7 Feb 2024
I would like to publish my documentation to HTML using publish. I am using a package namespace, and classes with methods in separate files.
I am able to publish the class documentation using the syntax:
publish('namespace.ClassName','format','html','outputDir','helpfiles','evalCode', false,'showCode',false);
However, I can't seem to publish the documentation for the class method (which is contained in a separate file). If I call:
publish('namespace.ClassName.methodName','format','html','outputDir','helpfiles','evalCode', false,'showCode',false);
I get:
Error using publish
Unable to find "namespace.ClassName.methodName".
However, this call works correctly:
help namespace.ClassName.methodName
How can I publish the method documentation?

Risposte (1)

Ishu
Ishu il 7 Feb 2024
Hi Bradley,
The "publish" function is typically used to convert scripts that contain markup into formatted documents, such as HTML, LaTeX, or Markdown. It's not directly intended for publishing class method documentation. However, if you want to publish documentation for a class method, you can create a separate script that includes the call to the method and its documentation, and then publish that script.
Create a file publish_method.m :
% PUBLISH_METHOD - This script is used to publish documentation for a specific method
% Create an object of your class
obj = namespace.ClassName();
% Call the method
result = obj.methodName();
% Describe the output or behavior
disp('Method Publish file');
To publish the script run below command:
publish('publish_method','format','html','outputDir','helpfiles','evalCode',false,'showCode',false);
For more information on "publish" refer to the below documentation:
Hope it helps!

Categorie

Scopri di più su Software Development Tools in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by