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

guiuigetfilexlsread

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.

Best 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}
Related Question