From: Maxx on 29 Jun 2010 09:48 Hello all, I've been working on a gui with GUIDE that extracts data from an excel sheet and places it into a cell array. The listbox then updates its contents based upon what item the user selects. The default value for listboxes is >1<, so the function skips the first array that I need to appear in the listbox and goes immeadiately to the last 'set' command. How can I stop this from happening? .... .... get(handles.figure1,'SelectionType'); if strcmp(get(handles.figure1,'SelectionType'),'open') set(handles.listbox1,'string',cellstr(substance)); substance_val=get(handles.listbox1,'value') if substance_val~=0 set(hObject,'string',data_excel(substance_val,:)); end end .... .... The default string in the listbox is "Pure Component". When I double click on it, the first string appears in the listbox with its corresponding data from a master array (data_excel ... 54X4). So it displays the name/row listed in column 1, gets the value(x) of the row, and displays the data in value(x) columns 2:4. This is good, I just need to be able to select something other than substance_val=1 (value=1). Any ideas? I'm not so good with callbacks or handles and the only examples I can find are with directories and "If" structures. Maxx
|
Pages: 1 Prev: Quick Histogram Question Next: Zero Crossing in S-Functions |