Path: news.mathworks.com!not-for-mail
From: "Steven Lord" <slord@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: error"Attempt to reference field of non-structure array"
Date: Thu, 30 Jul 2009 09:18:23 -0400
Organization: The MathWorks, Inc.
Lines: 56
Message-ID: <h4s6ig$cqn$1@fred.mathworks.com>
References: <g27ddf$2gn$1@fred.mathworks.com> <g28r6k$b3o$1@fred.mathworks.com> <h4rn5e$6jk$1@fred.mathworks.com>
Reply-To: "Steven Lord" <slord@mathworks.com>
NNTP-Posting-Host: lords.dhcp.mathworks.com
X-Trace: fred.mathworks.com 1248959888 13143 144.212.105.187 (30 Jul 2009 13:18:08 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 30 Jul 2009 13:18:08 +0000 (UTC)
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5512
X-RFC2646: Format=Flowed; Original
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579
Xref: news.mathworks.com comp.soft-sys.matlab:559611



"guj " <gulatiakshay@gmail.com> wrote in message 
news:h4rn5e$6jk$1@fred.mathworks.com...
> "Steven Lord" <slord@mathworks.com> wrote in message 
> <g28r6k$b3o$1@fred.mathworks.com>...
>>
>> "lichao qi" <qilichao1106@126.com> wrote in message
>> news:g27ddf$2gn$1@fred.mathworks.com...
>> > when i open a finished gui .fig file with the guide,it is
>> > ok.However the error happen once i double click it.do
>> > anybody know why?
>>
>> There are two pieces to a GUI generated by GUIDE -- the FIG-file and the
>> M-file.  You should run your GUI by running the M-file -- it does some 
>> setup
>> then opens the FIG-file.  When you open the FIG-file directly by
>> double-clicking on it in the Current Directory browser (which is where I
>> assume you double-clicked it) you open the FIG-file without doing the
>> M-file's setup first, and I'm pretty sure that's what causes the error 
>> you
>> described.
>>
>> -- 
>> Steve Lord
>> slord@mathworks.com
>>
>>
>
>
> Attempt to reference field of non-structure array !
> I always get this error and some time it gone by itself. Yesterday one i 
> was calling a funtion it was giving me error on some line. What this error 
> means can some explain it in a simple maner

The short version is that you're taking a variable that is not a struct 
array:

x = 1:10;

and trying to ask for a field of that variable, which doesn't work because 
regular numeric arrays don't have fields.

y = x.structFieldIndexingWillError

To determine why you receive this error, run your code using the debugging 
tools provided in the Editor.  If you open up the Help Browser (using the 
DOC function) and navigate to the Desktop Tools and Development Environment 
item under the MATLAB item in the tree, one of the items should be "Editing 
and Debugging M-Files".  Read through that to learn how to debug your code 
and locate the cause of this error.

-- 
Steve Lord
slord@mathworks.com