How to doc() a command which is overloaded by multiple toolboxes
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Matt J
am 19 Sep. 2023
Beantwortet: Steven Lord
am 19 Sep. 2023
The evaluate() command has a version in both the the Curve Fitting Toolbox and in the Optimization Toolbox. How does one use doc() to resolve the ambiguity and bring up the documentation of the desired version?
0 Kommentare
Akzeptierte Antwort
Steven Lord
am 19 Sep. 2023
The evaluate function in both those products (and a few others) is a method of different types of objects.
which -all evaluate
In Curve Fitting Toolbox, evaluate is a method of the fittype object.
help fittype.evaluate
If I used doc fittype.evaluate it will bring up the documentation page for that method. In my MATLAB Online session that method does not have a dedicated function reference page so it brings up the help text instead.
The evaluate method for OptimizationExpression objects didn't show up in my first which call because that class was not loaded in memory at the time I called which. Let me make one and you'll see that now the Optimization Toolbox object methods are listed:
x = optimvar('x');
y = optimvar('y');
prob = optimproblem;
prob.Objective = -x -y/3;
which -all evaluate
Now if I ask for help:
help optim.problemdef.OptimizationExpression.evaluate
and if I asked for doc on that method name in MATLAB Online it would bring up the page in the online documentation that I linked above.
This is documented in the help and documentation for the doc function. [Which I'd guess is one of the less frequently referenced documentation pages.]
"Some classes and other packaged items require that you specify the package name. Events, properties, and some methods require that you specify the class name. Separate the components of the name with periods, such as:"
Also see the "Class and Method Reference Pages" example on that doc page.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Toolbox Distribution finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!