Azzera filtri
Azzera filtri

Pass 'cfit' object into a new function

4 visualizzazioni (ultimi 30 giorni)
Cullen
Cullen il 19 Mar 2013
I am developing a GUI where I ask the user what data they want to regress, and to select the functional form of the data regression. The GUI will then gather the correct data, and regress the data using the fit() function. This will generate a cfit class variable. This is what I have working.
Next I would like to be able to take the regression of that data and pass it into a separate function so that I can manipulate it.
Simply it can be described as follows:
X = [];
Y = [];
regression = fit(X, Y, FitType, opts);
[new_line] = ModifyLine(X, Y, regression)
When I try to run the code as show above I get the Error:
Undefined function 'File_Name' for input arguments of type
'cfit'.
My regression function is properly formatted because I am able to plot the data and the regression at the end of the function.
I know I could generate the fit function as a sub function to ModifyLine however this would start to require me to pass in and out an excessive number variables.
Does anyone know how to pass a cfit type into a function? or a way to bypass the pass through statement and directly import from the other function?
Thanks

Risposte (1)

Tom Lane
Tom Lane il 20 Mar 2013
You appear to be assigning [] to both X and Y, then fitting to that. I wouldn't expect that to work.
However, if you are successful in creating the regression variable, you should be able to pass it into another function. The error message complains that it can't find a function called File_Name. Are you trying to call such a function from inside ModifyLine, and do you have a File_Name function on your path?

Categorie

Scopri di più su Linear and Nonlinear Regression in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by