I am new to GUIDE and I came across a similar problem a few days ago. However, I think I have solved mine. Here's the context (it might be helpful for a clear understanding) before I post my solution:
I have several check boxes in my GUI. I also have a function (say 'Mouse') that does stuff when I press a mouse button. My target was to clear the check boxes every time I click on the mouse. At first, I wrote this line inside 'OpeningFcn' and 'Mouse':
And this happened while executing the code >> "Attempt to reference field of non-structure array." (and other related errors)
While debugging, I found out that the handles for 'checkbox1' was getting overwritten by the handles of 'OutputFcn'
1. In the 'OpeningFcn', I copied 'handles' to a new variable 'handles1':
handles1 = handles;
2. Set 'handles1' as a 'global' variable inside the 'Mouse' function.
3. Changed the input argument 'handles' to 'handles1' for checkbox1 (for all the checkboxes actually). So it looks like this:
function checkbox1_Callback(hObject, eventdata, handles1)
Now it works fine. Hope this helps.