readstruct getting error when attempt to run function in background
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Rik
am 2 Feb. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Platform and License finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!