Azzera filtri
Azzera filtri

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

3 visualizzazioni (ultimi 30 giorni)
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)

Risposta accettata

Harsheel
Harsheel il 16 Mag 2014
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);

Più risposte (0)

Categorie

Scopri di più su Parallel Computing Fundamentals in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by