Publish class method when using separate files

7 views (last 30 days)
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?

Answers (1)

Ishu
Ishu on 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!

Categories

Find more on Software Development Tools 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!