From: Maxx Chatsko on
Walter Roberson <roberson(a)hushmail.com>
> We need to see the set() in context.

function listbox1_CreateFcn(hObject, eventdata, handles)
[substance,substance]=xlsread('PSL Master Sheet.xlsx','SWIR',...
'A2:A10000');

set(handles.listbox1,'UserData',substance);

I noticed that cells were under UserData in the Property Inspector so I tried changing 'string' to 'userdata', but no dice. It doesn't work with string either. Also tried both with cell and char. Same result...
From: ImageAnalyst on
On Jul 30, 11:30 am, "Maxx Chatsko" <chats...(a)chemimage.com> wrote:
> Walter Roberson <rober...(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.
----------------------------------------------------------------------------------------------------------------------------------------------

I believe a listbox can only take an N rows by 1 column cell array.
Do you get this shape of cell array when you read in your Excel file?
It will probably fail if your data is not in one single column in your
spreadsheet.
From: Maxx Chatsko on
ImageAnalyst <imageanalyst(a)mailinator.com> >

> I believe a listbox can only take an N rows by 1 column cell array.
> Do you get this shape of cell array when you read in your Excel file?
> It will probably fail if your data is not in one single column in your
> spreadsheet.

Hmmm. My array is just a list of pharmaceutical agents with one column. In Property Inspector you can set the number of columns and rows under UserData cell. I tried changing it off the default (1x0) but it didn't work. This doesn't seem too difficult, but of course its proving to be. Are there settings in Property Inspector or guide that I might be overlooking?
From: Maxx Chatsko on
> ImageAnalyst <imageanalyst(a)mailinator.com> >

I think the problem is that all of the names are different lengths as a cell array. So I converted it to a structure and read them into the listbox with a for loop. Debugging in progress. Anyone wanna test my theory with me feel free...
From: Walter Roberson on
Maxx Chatsko wrote:
> Walter Roberson <roberson(a)hushmail.com>
>> We need to see the set() in context.
>
> function listbox1_CreateFcn(hObject, eventdata, handles)
> [substance,substance]=xlsread('PSL Master Sheet.xlsx','SWIR',...
> 'A2:A10000');
>
> set(handles.listbox1,'UserData',substance);
>
> I noticed that cells were under UserData in the Property Inspector
> so I tried changing 'string' to 'userdata', but no dice. It doesn't work
> with string either. Also tried both with cell and char. Same result...

I suggest you put a breakpoint in at the set() line, and examine the
value of handles to see whether it is what is you expect.
First  |  Prev  | 
Pages: 1 2
Prev: PCA problem and Memory error
Next: Redefine 0/0