- Ensure xData and yData are correctly formatted and do not contain NaN or Inf values, as these can cause issues with fitting routines.
- Verify that xData and yData are both vectors and have the same length.
Error using fit>iFit (line 348) Error while trying to evaluate FITTYPE function... with FASTCORMICS
8 views (last 30 days)
Show older comments
Hi!
I am using the FASTCORMICS tool on MATLAB R2020a and when running the discretize_FPKM function I'm getting these errors:
Error using fit>iFit (line 348)
Error while trying to evaluate FITTYPE function :
Wrong number of arguments.
Error in fit (line 116)
[fitobj, goodness, output, convmsg] = iFit( xdatain, ydatain, fittypeobj, ...
Error in createFit_r (line 27)
[fitresult, gof] = fit(xData, yData, ft, opts );
Error in discretize_FPKM (line 85)
[fitresult_r, ~] = createFit_r(xi, hybrid_curve);
I checked the fit code and everything is the way it should be.
I am a little bit lost here. Any ideas on how to solve this problem?
0 Comments
Answers (1)
Aditya
on 18 Apr 2024
The error message you're encountering in MATLAB when using the fit function within the FASTCORMICS tool indicates an issue with how the function is being called, specifically suggesting that the fittype function received an incorrect number of arguments. This can occur due to several reasons, such as an incorrect specification of the model type, issues with the input data, or potentially a mismatch between the expected input format of the fit function and what is actually being provided by createFit_r.
Here are several steps and checks to help you troubleshoot and potentially resolve this issue:
1. Check the fittype Specification
The fittype object specifies the type of model or equation to fit to the data. Ensure that the model type (e.g., linear, polynomial, custom equation) specified in createFit_r or passed to it is correctly formatted. For example, for a linear fit, you might use:
ft = fittype('poly1');
ft = fittype('a*x^2+b*x+c', 'independent', 'x', 'dependent', 'y'); %for custom model
2. Validate Input Data
You can check for and remove NaN values using:
validIndices = ~isnan(xData) & ~isnan(yData);
xData = xData(validIndices);
yData = yData(validIndices);
If after these checks the problem still isn't resolved, providing more details about the createFit_r function and how it's called within discretize_FPKM could help in giving more targeted advice.
0 Comments
See Also
Categories
Find more on Linear and Nonlinear Regression in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!