Can't pass COM object handle into spmd body
Ältere Kommentare anzeigen
I am using an application object opened using ActiveX server,
oApp = actxserver('my.application');
in the definition of an anonymous function,
fHandle = @(x) myFunction(x,oApp);
(I am processing the data 'x' with an external application 'my.application'.)
This function handle works fine when I call it form the MATLAB client, like this:
fHandle(5)
ans =
100
However, when I call it from within spmd body,
spmd
if labindex == 1
y = fHandle(x);
end
.....
end
I am getting an error message like "Trying to reference an un-structured object", and you can see this object is oApp. So, the lab from the spmd pool does not oApp as a valid application object. I tried to open this object inside the spmd body, but I cannot define an anonymous function there (documentation says the same).
Can anybody please give me a hint how to solve this problem? -Thanks a lot!
Akzeptierte Antwort
Weitere Antworten (1)
Edric Ellis
am 14 Okt. 2011
0 Stimmen
As you've discovered, there are some limitations with passing handle-type objects into the body of SPMD blocks. This is because the workers executing the SPMD block are separate processes, potentially on separate machines. Therefore the data is effectively saved and reloaded (but without going via the disk).
Perhaps you could use my 'WorkerObjectWrapper' which is designed to help managing the lifetime of objects to be used within SPMD and PARFOR.
1 Kommentar
matlabUser
am 14 Okt. 2011
Kategorien
Mehr zu Use COM Objects in MATLAB finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!