フィルターのクリア

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

3 ビュー (過去 30 日間)
Doriana
Doriana 2014 年 5 月 16 日
コメント済み: Doriana 2014 年 5 月 19 日
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);
  1 件のコメント
Doriana
Doriana 2014 年 5 月 19 日
Thank you Harsheel, the program works correctly.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeParallel Computing Fundamentals についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by