Compiling Matlab Code: it works in Matlab but not when compiled.

3 次查看(过去 30 天)
Hello all,
I have a program that use parallel toolbox. That works perfectly in Matlab but when I compile it and execute it, I get this error: Error using parpool. Allowed value for the second argument is an integer specifying the pool size.
the program crashes in this row:
parpool('local' ,poolsize);
To run the program outside matlab I insert as a parameter :
'poolsize' '2'
Thank you,
P.s i'm using matlab (2014a) and mcr 8.3 (2014a)

采纳的回答

Harsheel
Harsheel 2014-5-16
Not sure how you're 'inserting' the parameter but seems like you're passing the arguments from command line. If so then, all arguments are passed in as characters. You need to convert it to integer and then pass it to parpool. Like:
if ischar(poolSize) %where poolSize stores the user input
poolSize=str2num(poolSize); %convert string to number
end
parpool('local',poolSize);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Parallel Computing Fundamentals 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by