Clear Filters
Clear Filters

Discrepancy in functions between MATLAB versions

16 views (last 30 days)
I am bouncing between two machines using R2021b and R2024a Respectively. In my code that I had built on the R2021 machine, I had used the function fit to acquire a fit object for experimental data. In moving to the R2024 machine, the fit function seems to have a different use and returns the fllowing error when I run the code:
Incorrect number or types of inputs or outputs for function fit.
I am looking for a redirection to a function that would work as the fit function would in R2021 but for R2024. Any help would be appreciated, thank you.

Accepted Answer

Steven Lord
Steven Lord on 3 Jun 2024
What does the following command show when run in each of the versions of MATLAB?
which -all fit
/MATLAB/toolbox/curvefit/curvefit/fit.m /MATLAB/toolbox/stats/stats/@gmdistribution/fit.m % gmdistribution method
My guess is that you have Curve Fitting Toolbox installed in your installation of release R2021b but don't have it in your installation of release R2024a. To check, run this code in both installations:
ver curvefit
-------------------------------------------------------------------------------------------------- MATLAB Version: 24.1.0.2605623 (R2024a) Update 3 MATLAB License Number: 40912989 Operating System: Linux 5.15.0-1052-aws #57~20.04.1-Ubuntu SMP Mon Jan 15 17:04:56 UTC 2024 x86_64 Java Version: Java 1.8.0_292-b10 with AdoptOpenJDK OpenJDK 64-Bit Server VM mixed mode -------------------------------------------------------------------------------------------------- Curve Fitting Toolbox Version 24.1 (R2024a)
If it doesn't show that last line in release R2024a, install Curve Fitting Toolbox.
This assumes you weren't calling the fit method of a gmdistribution object (Gaussian mixture model) created with Statistics and Machine Learning Toolbox. If that's the case (if you created a gmdistribution and called fit on it) check if you have that toolbox.
ver stats
-------------------------------------------------------------------------------------------------- MATLAB Version: 24.1.0.2605623 (R2024a) Update 3 MATLAB License Number: 40912989 Operating System: Linux 5.15.0-1052-aws #57~20.04.1-Ubuntu SMP Mon Jan 15 17:04:56 UTC 2024 x86_64 Java Version: Java 1.8.0_292-b10 with AdoptOpenJDK OpenJDK 64-Bit Server VM mixed mode -------------------------------------------------------------------------------------------------- Statistics and Machine Learning Toolbox Version 24.1 (R2024a)

More Answers (0)

Products


Release

R2024a

Community Treasure Hunt

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

Start Hunting!