indexed list of fit objects?

4 views (last 30 days)
Craig
Craig on 22 Jul 2011
Guys - I've been beating my head on this for a couple of days & need help. I have a long series of sfit objects from fitting a database, and I need to store these objects in an indexed list so I can refer to them explicitly in an feval call inside a parfor loop. The serial code constructs a string for the name of the sfit object with the index imbeded in the name, and then uses eval to insert this name into the command line; obviously, this violates transparency. I've tried building a cell array for the objects, but what appears to be stored in the cells is just one of the coeffients of the sfit.
Any suggestions? Thanks!

Answers (1)

Konrad Malkowski
Konrad Malkowski on 3 Aug 2011
Have you tried placing the body of the parfor loop into a function?
For example, instead of:
parfor i = 1:10
y(i) = x(i) * 10;
end
use:
parfor i = 1:10
y(i) = foo(i, x);
end
function y = foo(i, x);
y = x(i) * 10;
end

Tags

Community Treasure Hunt

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

Start Hunting!