How to Find What Toolbox a Function is in From Documentation?

Hi,
I hope the answer to this isn't staring me in the face...but I'm trying to use the 'addTerms' function
and I cannot figure out from the documentation what toolbox I need to download in order to use it.
I already have the 'Statistics and Machine Learning Toolbox' version 12.3. However, my MATLAB install is not recognizing the 'addTerms.m' function.
Thanks for your consideration,
tom

 Réponse acceptée

Matt J
Matt J le 1 Juin 2022
See the upper-left corner of the doc page. In this case, it is the Statistics and Machine Learning Toolbox.

6 commentaires

Thanks Matt,
I guess I have a different problem then since I already have that toolbox installed.
Not sure why MATLAB is not letting me use that function...
tom
Matt J
Matt J le 1 Juin 2022
Modifié(e) : Matt J le 1 Juin 2022
I assume you have at least R2012a, which is when it was introduced? And what happens when do,
>>which -all addTerms
note that addTerms is a method of LinearModel objects, and does not exist for any other kind of input.
Matt, I am using R2022a.
Oddly, your suggestion first yielded this:
>> which -all addTerms
C:\Program Files\MATLAB\R2022a\toolbox\simulink\core\general\addterms.p
Then, I just re-did it without changing anything and then got this:
>> which -all addTerms
C:\Program Files\MATLAB\R2022a\toolbox\stats\classreg\+classreg\+regr\TermsRegression.m % LinearModel method
C:\Program Files\MATLAB\R2022a\toolbox\stats\classreg\+classreg\+regr\FormulaProcessor.m % classreg.regr.LinearFormula method
So it is being recognized now as a method.
Walter,
I think you solved my confusion. I was attempting to input a cfit object into the command because I am using a nonlinear model in my regression.
Thanks to you both!
Walter is correct. You can see this by scrolling down to the Input Arguments section on that documentation page, which lists as the description of the mdl input argument:
"Linear regression model, specified as a LinearModel object created using fitlm or stepwiselm."
If you tried to call addTerms with something that's not a LinearModel object as the first input, that doesn't satisfy the requirements of the function and so MATLAB throws an error.
Because it is a class method, MATLAB would not be able to see it at all for other inputs.

Connectez-vous pour commenter.

Plus de réponses (0)

Produits

Version

R2022a

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by