我尝试使用matlab gui中的按钮导入一个excel数据。第一列由日期组成,而导入第一列的行由第二列替换,最后一列保持为空。我的代码如下,请帮助我解决这个问题。
function pushbuttonLoadData_Callback(hObject, eventdata, handles)
% hObject handle to pushbuttonLoadData (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
handles.output = hObject;
filename=uigetfile({'*.xls';'*.csv'});
handles.filename=filename;
[data,colNames] = xlsread(filename);
class(colNames)
size(colNames)
colNames{1,1}
set(handles.uitable1,'Data',data,'ColumnName',colNames(1,:));