How to use multiple cores

I use matlab to generate a series of input files and perform a simulation with each of those by an external program.
eval(sprintf('!%s "%s"','"[a bat file]"',[a matlab generated ini file]))
Using the line above matlab will wait until one simulation has ended before starting a new one. One simulation uses only one of 4 available cores. I would like to know if I can send 4 files into parallel simulation.
Thanks.

 채택된 답변

Friedrich
Friedrich 2011년 11월 3일

2 개 추천

Hi,
try to use the & so that ML don't wait, saying:
eval(sprintf('!%s "%s" &','"[a bat file]"',[a matlab generated ini file]))
Or use Parallel Computing Toolbox to run several function in parallel.

댓글 수: 2

Jan
Jan 2011년 11월 3일
I'd omit the EVAL and SPRINTF:
system(['"<a bat file>" "', <a matlab generated ini file>, '" &'])
Erik de Boer
Erik de Boer 2011년 11월 3일
Thank you both. All my simulations run simultaneous now.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by