Can a system() Command be used Inside a Function Called from Inside a parfor Loop?
Ältere Kommentare anzeigen
Is the following code allowed:
result = zeros(100,1);
parfor ii = 1:100
% do something
result(ii) = myfun(resultfromdoingsomething)
end
function result = myfun(inp)
% do something and write a file based on inp
status = system(command); % command executes an executable that reads in the file that was written and produces an output file
result = % read in the file produced by the executable and grab a value to return
% delete the files
end
Even if allowed, are there any risks to be concerned about?
Would also like to know if there are any differences between 2024a and 2019b in this regard.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Parallel for-Loops (parfor) finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!