listbox items to array



Hello everyone,

I am trying to get the currently selected items in a listbox into array. The end goal is to then write that array to an excel file (using xlswrite I suppose).

This is what I have so far. This code populates the listbox from an excel sheet and allows it to be updated:

function listbox1_CreateFcn(hObject, eventdata, handles)

[substance,substance]=xlsread('C:\Users\ecorbett\Documents\VCoachData\Labels\RHA.xlsx','Sheet1','A1:A10000');
set(hObject,'string',substance); if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end

end %function listbox1_CreateFcn()

function pushbutton1_Callback(hObject, eventdata, handles)

[substance,substance]=xlsread('C:\Users\ecorbett\Documents\VCoachData\Labels\RHA.xlsx','Sheet1','A1:A10000');
set(handles.listbox1,'string',substance);
msgbox('The listbox has been updated.','Update Complete','help');

end


function pushbutton2_Callback(hObject, eventdata, handles)

%take the currently selected items in the listbox and store them into an array.. somehow%

end

another question I guess is do I need to use an array? I was under the impression that the items in a listbox are already a cell array?
.



Relevant Pages

  • Mover Object in the FFC
    ... I am passing an array to a form, which is picked up by Mover. ... The user can select the job code they and and the above line then becomes ... I only update the array after the item is in the selected listbox. ... whenever I get focus back to the "selected items" listbox, ...
    (microsoft.public.fox.programmer.exchange)
  • listbox help
    ... I am trying to get the currently selected items in a listbox into an excel sheet. ... Another question is do I need to use an array? ...
    (comp.soft-sys.matlab)
  • Re: Populate a Multi-Column ListBox
    ... two-dimensional array to load into a ListBox or ComboBox. ... For a multicolumn ListBox or ComboBox, AddItem inserts an entire row, ... If you populate a ListBox with an Array using the List of Column ... Dim myArray As Variant ...
    (microsoft.public.word.vba.userforms)
  • Re: Populate a Multi-Column ListBox
    ... two-dimensional array to load into a ListBox or ComboBox. ... For a multicolumn ListBox or ComboBox, AddItem inserts an entire row, ... If you populate a ListBox with an Array using the List of Column ... Dim myArray As Variant ...
    (microsoft.public.word.vba.userforms)
  • Re: Populate a Multi-Column ListBox
    ... two-dimensional array to load into a ListBox or ComboBox. ... For a multicolumn ListBox or ComboBox, AddItem inserts an entire row, ... If you populate a ListBox with an Array using the List of Column ... Dim myArray As Variant ...
    (microsoft.public.word.vba.userforms)