How do i get columns of excel files into pop up menu?

Hi team, I am facing problem in getting columns of excel file into popup menu. I used the following code.
filename=uigetfile({'*.xls';'*.csv'});
handles.filename=filename;
set(handles.editpath,'String',filename)
guidata(hObject, handles)
setpopupmenuString(handles.popupmenucycle,eventdata,handles)
function setpopupmenuString(hObject,eventdata,handles)
filename=handles.filename;
[numbers,colNames]=xlsread(filename);
set(hObject,'String',colNames);
The popup menu is displaying values of 1st column alone with its header. Someone please help me in solving this problem.

 Accepted Answer

It would be better if you used
set(hObject, 'String', colNames(1,:) );
Just after you have done the set() in your function, please add
class(colNames)
size(colNames)
and tell us what it displays. If it shows the class as being cell, please also show
colNames{1,1}

More Answers (0)

Categories

Asked:

on 13 Dec 2013

Commented:

on 13 Dec 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!