Publish class method when using separate files

조회 수: 7 (최근 30일)
Bradley Treeby
Bradley Treeby 2022년 10월 12일
답변: Ishu 2024년 2월 7일
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?

답변 (1개)

Ishu
Ishu 2024년 2월 7일
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!

카테고리

Help CenterFile Exchange에서 Software Development Tools에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by