From: Maxx Chatsko on
Hello all,
I created a gui with guide. A listbox in the main figure was set by typing the list in the STRING edit in Property Inspector, but the list may be upgraded from time to time. So I'm attempting to load the listbox from an array created with xlsread. In [num, txt]=xlsread() the txt is a cell array, but it doesn't load into the listbox as a cell array. Or a struct, which is what I think it wants. My code in the CreateFcn for the listbox is:

set(handles.listbox1,'string',substance_listbox1);

is this wrong? How do I set the listbox?
Thanks
Maxx
From: Maxx Chatsko on
When I run the program I get the following error.

Attempt to reference field of non-structure array.
Error in ==> PSLprcsr>listbox1_CreateFcn at 61
set(handles.listbox1, 'string', substance_listbox1);

It appears when the array I pass to set or uicontrol is a cell or char...
From: Walter Roberson on
Maxx Chatsko wrote:
> When I run the program I get the following error.
>
> Attempt to reference field of non-structure array.
> Error in ==> PSLprcsr>listbox1_CreateFcn at 61
> set(handles.listbox1, 'string', substance_listbox1);
>
> It appears when the array I pass to set or uicontrol is a cell or char...

No, the implication is that "handles" is not a structure.
From: Maxx Chatsko on
Walter Roberson <roberson(a)hushmail.com>

> No, the implication is that "handles" is not a structure.

Right I was saying that it appears for both cases not that it is referring to the cell or char. But that doesn't really help me solve my dilemna....I use set in other places in my code with handles and it works fine. So how do I set a listbox?
Thank you for your input.
From: Walter Roberson on
Maxx Chatsko wrote:
> Walter Roberson <roberson(a)hushmail.com>
>
>> No, the implication is that "handles" is not a structure.
>
> Right I was saying that it appears for both cases not that it is
> referring to the cell or char. But that doesn't really help me solve my
> dilemna....I use set in other places in my code with handles and it
> works fine. So how do I set a listbox?

We need to see the set() in context.
 |  Next  |  Last
Pages: 1 2
Prev: PCA problem and Memory error
Next: Redefine 0/0