indexed list of fit objects?
조회 수: 1 (최근 30일)
이전 댓글 표시
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!
댓글 수: 0
답변 (1개)
Konrad Malkowski
2011년 8월 3일
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
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Parallel for-Loops (parfor)에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!