我正在尝试创建一个包含 parfeval 语句和等待栏的 matlab 独立可执行文件。以下代码在 matlab 运行时中完美运行。但是,使用 mcc -m test_mcc.m 编译后,我收到以下错误:
错误:
Error using parallel.FevalFuture/fetchNext (line 243)
The function evaluation completed with an error.
Error in test_mcc (line 11)
Caused by:
An error occurred interpreting the results of the function evaluation.
parallel:fevalqueue:FetchNextFutureErrored
代码:
function test_mcc()
N = 100;
for idx = N:-1:1
% Compute the rank of N magic squares
F(idx) = parfeval(@rank,1,magic(idx));
end
% Build a waitbar to track progress
h = waitbar(0,'Waiting for FevalFutures to complete...');
results = zeros(1,N);
for idx = 1:N
[completedIdx,thisResult] = fetchNext(F);
% store the result
results(completedIdx) = thisResult;
% update waitbar
waitbar(idx/N,h,sprintf('Latest result: %d',thisResult));
end
delete(h)
end
任何线索?