How do you preallocate an array of FevalFutures?
조회 수: 7 (최근 30일)
이전 댓글 표시
I want to run many experiments using parfeval. How can I preallocate an array of the futures? The sample below results in an error saying the constructor needs more arguments.
experiments = parallel.FevalFuture(100)
for i = 1:100
experiments(i) = parfeval(@magic, 1, 5);
end
댓글 수: 0
답변 (1개)
Walter Roberson
2023년 10월 23일
Loop backwards.
clear experiments
for i = 10:-1:1
experiments(i) = parfeval(@magic, 1, 5);
end
experiments
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with Statistics and Machine Learning Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!