I am using the Instrument Control Toolbox together with PicoTech’s MATLAB Instrument Driver for PicoScope 5000A/B Series (ps5000asdk10.5.2.1) to connect to my PicoScope 5442B device.
The example scripts are running successfully, i.e. I am able to connect, change settings, stream and disconnect from my device (I used PS5000A_IC_Generic_Driver_Streaming.m).
My target application is a GUI, however. Running exactly the same code from within the callback functions (e.g. of Connect, Acquire, etc. pushbuttons) the program runs into crashes or errors upon execution.
I found that everything works well if I move the relevant variables from global workspace to the base workspace before execution of the driver functions.
function picoScopeConnect( )
global ps5000aEnuminfo ps5000aMethodinfo ps5000aStructs ps5000aThunkLibName
[ps5000aMethodinfo, ps5000aStructs, ps5000aEnuminfo, ...
ps5000aThunkLibName] = ps5000aMFile;
assignin('base', 'ps5000aMethodinfo', ps5000aMethodinfo);
assignin('base', 'ps5000aStructs', ps5000aStructs);
assignin('base', 'ps5000aEnuminfo', ps5000aEnuminfo);
assignin('base', 'ps5000aThunkLibName', ps5000aThunkLibName);
ps5000aDeviceObj = icdevice('picotech_ps5000a_generic', '');
What is working only with the assignin instructions. This is simple for the connect operation but getting pretty laborious e.g. for streaming.
Does anyone know how to solve this issue in a more elegant way? Even if there is no more elegant way, is there a possibility to synchronize the global workspace and the base workspace such that I can omit to regularly move variables between the workspaces?