I try to read data from two Keysight oscilloscopes in parallel with Matlab (2015a). To do that I use the parallel computing toolbox with the spmd command. I have a function to read the data which accepts a visa object as parameter and returns the rawdata. This works fine outside the spmd command like this (scope1 and scope2 are open visa objects):
scope = {scope1, scope2}
scopedata1 = scopeGetCh1Raw(scope{1});
scopedata2 = scopeGetCh1Raw(scope{2});
I get the data from both oscilloscopes.
If I do:
spmd
scopedata = scopeGetCh1Raw(scope{labindex});
end
I get the following error:
Error detected on workers 1 2.
Caused by:
Error using icinterface/fprintf (line 147)
OBJ must be connected to the hardware with FOPEN.
Error using icinterface/fprintf (line 147)
OBJ must be connected to the hardware with FOPEN.
Any ideas what's going wrong?
Cheers Nils
The workers operating on the body of your spmd
block are separate processes. I presume you'll need to call fopen
inside spmd
, something like:
spmd
myScope = fopen(...); % do whatever to open the scope
scopedata = scopeGetCh1Raw(myScope);
end