I am trying to extract data from a uitable
I have created and export it into an Excel sheet with the Column Headers along with it. By it keeps throwing an error, stating:
Stacktrace:
Error using vertcat
Dimensions of matrices being concatenated are not consistent.
Error in FatherSonGUI>generateWAR (line 124)
num = [col';data]
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in FatherSonGUI (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in @(hObject,eventdata)FatherSonGUI('generateWAR',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
Example Picture:
Here's a sample of my Code that I have written:
dat = dyn_conformer.Data;
set(f,'name','Title','numbertitle','off') %renames the Title Figure
cnames = {'Task Mnemonic','Success Status','External Update Required', 'Correlation ID', 'Event Name','External System','Tech Exception Status','Returned Status','Return Cancel','Return Customer','Return Technical'};
rnames = {'1','2','3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20','21', '22', '23', '24', '25'};
t = uitable('Parent',f,'Data',dat,'ColumnName',cnames,...
'RowName',rnames,'Position',[10 100 1150 370]); % size of the values inside the figure object
col = get(t,'ColumnName')
data = get(t,'Data')
num = [col';data]
xlswrite('show.xls',num)
The data is being compiled from a database, with simple data within the fields. If I were to remove the col'
element from the num
variable, it exports only the data. However, I would like to export the column names and the data together, where in the end it will look like a proper spreadsheet.
I would appreciate some help on this.