Hello, I'm trying to run my own m file but I can't connect to the scope because of the following error:
Error using instrument/delete (line 82)
Operation failed: An error occurred while executing the driver
disconnect code.
Attempt to reference field of non-structure array.
If this error is not an instrument error, use MIDEDIT to inspect the
driver.
However, PS3000A_IC_Generic_Driver_Block.m runs fine. In fact, if I run Generic, then don't clear the workspace variables then I am actually able to run my m file and connect just fine. I've narrowed it down to the following two structures which must not be cleared in order for my file to work: ps3000aEnuminfo, ps3000aStructs.
I saw that this error was listed here and I have checked that no output variables have had their name changed. Even if they had been, I don't see why it would only break my program and not Generic. Do I just have to wait until this is "resolved in future releases" or is there something I can do to fix it?
My script is a GUI. I've not changed the initialisation or opening function etc. The script doesn't do anything else until I press a button called connectscope, these are the first few lines of the callback:
function connectscope_Callback(hObject, eventdata, handles)
%% Load Configuration Information
PS3000aConfig
%% Device Connection
% Create a device object.
ps3000aDeviceObj = icdevice('picotech_ps3000a_generic.mdd', 'AW742/012');
% Connect device object to hardware.
connect(ps3000aDeviceObj)
% etc
It's identical to the Generic Run Block but doesn't make it past icdevice.
Strange thing is this actually worked totally fine when I last tried it a couple of weeks ago. I moved on to a different project with the Picoscope and when I got this error in the new project, I came back to this one and it also isn't working. It's in an entirely different folder so I couldn't have accidentally edited any important files that would affect them both.
I think the issue might be due to the variables from the PS3000aConfig script being loaded into the function workspace as opposed to the base workspace.
Please take a look at this question on the MATLAB Answers site as this may help.
Please note that Pico Technology is not responsible for the content of third party sites.