3206A 'Attempt to reference field of non-structure array'

Post your MATLAB discussions here
Post Reply
ChristyS
Newbie
Posts: 0
Joined: Mon Jun 15, 2015 2:44 pm

3206A 'Attempt to reference field of non-structure array'

Post by ChristyS »

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?

Regards,
Christy

Hitesh

Re: 3206A 'Attempt to reference field of non-structure array

Post by Hitesh »

Hi ChristyS,

What is your script doing prior to creating the icdevice object?

Are the PicoConstants.m, PicoStatus.m and the contents of the Functions folder on the MATLAB path?

Regards,

ChristyS
Newbie
Posts: 0
Joined: Mon Jun 15, 2015 2:44 pm

Re: 3206A 'Attempt to reference field of non-structure array

Post by ChristyS »

Hi Hitesh,

The files are definitely on the correct path.

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:

Code: Select all

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.

Hitesh

Re: 3206A 'Attempt to reference field of non-structure array

Post by Hitesh »

Hi ChristyS,

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.

Regards,

ChristyS
Newbie
Posts: 0
Joined: Mon Jun 15, 2015 2:44 pm

Re: 3206A 'Attempt to reference field of non-structure array

Post by ChristyS »

Hi Hitesh, that's sorted it, thank you.

Post Reply