readstruct getting error when attempt to run function in background
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have reduced down a function that I want to run in the background. When run as a background process, I get the error message back
>> [result] = fetchOutputs(WatchID); result
Error using parallel.Future/fetchOutputs
One or more futures resulted in an error.
Caused by:
Error using readstruct (line 72)
Use of function cd is not supported on a thread-based worker. Use alternatives supported on the background pool.
The function code follows:
function [resultBack] = BruteForceWrapper(inputStr)
%This is a brute force loop for the PhoneProcessWatcher
%Trying to launch it in the background but getting errors so doing brute
%force
resultBack = 'Starting';
systemXmlPath = 'D:\ThisSystem';
systemStruct = readstruct(fullfile( systemXmlPath,'Configuration.xml'));
debugLevel = systemStruct.ImageProcess.DebugLevel;
end
Code that is launching as background is below
WatchID = parfeval( backgroundPool, @BruteForceWrapper, 1, 'just text' );
Is this occuring with the readstruct as a background function? Is there an alternative that will work in a background run function?
0 commentaires
Réponses (1)
Rik
le 2 Fév 2022
Apparently it calls cd somewhere internally.
You could try reading the file will xmlread and parse to a struct with parseXML. I didn't try myself, so I don't know if that would result in the same problem.
0 commentaires
Voir également
Catégories
En savoir plus sur Platform and License dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!