MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

Create Help for Classes


In this section...
“Help Text from the doc Command” on page 30-2
“Custom Help Text” on page 30-3

Help Text from the doc Command


When you use the doc command to display help for a class, MATLAB automatically
displays information that it derives from the class definition.

For example, create a class definition file named someClass.m with several properties
and methods, as shown.

classdef someClass
% someClass Summary of this class goes here
% Detailed explanation goes here

properties
One % First public property
Two % Second public property
end
properties (Access=private)
Three % Do not show this property
end

methods
function obj = someClass
% Summary of constructor
end
function myMethod(obj)
% Summary of myMethod
disp(obj)
end
end
methods (Static)
function myStaticMethod
% Summary of myStaticMethod
end
end

end

30 Custom Help and Documentation

Free download pdf