# Unable to save 1024 x 1280 cell array of cfit objects.

2 views (last 30 days)
Tom Sudol on 3 Dec 2019
Commented: Tom Sudol on 5 Dec 2019
After performing curve fitting to produce a 1024x1280 cell array of cfit objects (taking several hours), my attempt to save the resulting workspace object fails. Busy icons spins for 10s of minutes, computer memory usage max's out to close to 100%, and then it stops. If I try to close Matlab, it tells me processes are still running. If I close anyway, a .mat file is present where I saved it but opening it does not show me a cell array of cfit objects.

Sean de Wolski on 3 Dec 2019
Why do you have this many cfit objects? What's the big picture? What type of cfit is it?
Tom Sudol on 4 Dec 2019
Sorry. Typo corrected above. It's a 1024x1280 array corresponding to an image. We are a manufacturer of imagers and cameras. We are looking to calibrate an imager's output data vs operating temperature by curve fitting the offset and gain of the individual pixel responses. The fit type is to an equation of the form a*exp(b*x)+(c*x)+d.

Sean de Wolski on 4 Dec 2019
Edited: Sean de Wolski on 4 Dec 2019
If I were you, I'd just store a,b,c,and d, as matrices directly then when necessary construct the cfit object on the fly with the known formula to use it (or if just evaluating the y value at each x just evaluate with array algebra). The cfit brings along a lot of other information with it which is not necessary for prediction.
You can construct the cfit on the fly because you know the formula and coefficients stored.
Or you can just run this for all x at once which will be fastest. It doesn't get you other object functions like predint though.
y = a.*exp(b.*x)+(c.*x)+d

#### 1 Comment

Tom Sudol on 5 Dec 2019
Thanks. Storing just the coefficients worked.

R2019b

### Community Treasure Hunt

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

Start Hunting!