How can I use the Instrument Control Toolbox (PicoScope device) properly across workspaces?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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.
Example:
function picoScopeConnect( )
global ps5000aDeviceObj
global ps5000aEnuminfo ps5000aMethodinfo ps5000aStructs ps5000aThunkLibName
% Load in enumerations and structure information - DO NOT EDIT THIS SECTION
[ps5000aMethodinfo, ps5000aStructs, ps5000aEnuminfo, ...
ps5000aThunkLibName] = ps5000aMFile;
% assign variables in base workspace such that they can be used by the
% Instrument Control Toolbox to connect to the device
assignin('base', 'ps5000aMethodinfo', ps5000aMethodinfo);
assignin('base', 'ps5000aStructs', ps5000aStructs);
assignin('base', 'ps5000aEnuminfo', ps5000aEnuminfo);
assignin('base', 'ps5000aThunkLibName', ps5000aThunkLibName);
% Create device
ps5000aDeviceObj = icdevice('picotech_ps5000a_generic', '');
% Connect device
connect(ps5000aDeviceObj);
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?
0 Commenti
Risposte (1)
Pico Technology
il 11 Giu 2015
Hi Christof,
Currently the Instrument Drivers rely on pulling information in from the base workspace which we understand is not ideal. This is something that we will investigate and see if an improvement can be made.
0 Commenti
Vedere anche
Categorie
Scopri di più su Instrument Control Toolbox Supported Hardware in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!