how can i assign multiple output from a function using parfor?
조회 수: 5 (최근 30일)
이전 댓글 표시
My function is generating 3-dimentional 5 variable. for montecarlo run i have to generate that 100 times. how can i use parfor that ?or do i have to use some other command?
댓글 수: 0
답변 (2개)
Walter Roberson
2015년 5월 25일
You should be able to use parfor for it.
maxtrial = 100;
results = cell(maxtrial,1);
parfor trialnum = 1 : maxtrial
generate first variable
generate second variable
generate third variable
generate fourth variable
generate fifth variable
calculate outputs with those variables
results{K} = outputs;
end
If the result is a single numeric value then use a numeric array instead of a cell array.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!