MATLAB Answers

yp78
0

How to print out tabulated data to excel

Asked by yp78
on 12 Aug 2018 at 20:53
Latest activity Edited by yp78
about 19 hours ago

Is there any way by which I can export (print) the output of tabulated data? My current code looks like this and returns an error message saying; "Error using xlswrite (line 172) input data must be a numeric, cell, or logical array".

 % The "result" is N by 1 double array
   C = categorical(result,[2 3 4 5 6],{'Mon','Tue','Wed','Thu','Fri'});
   tabulate(C)
 % print output
   fileName= 'output.xlsx';
   sheetName = 'sheet1';
   xlswrite(fileName,C,sheetName,'B3');

  3 Comments

I think you just need to assign the output of tabulate:

 C = tabulate(C);
dpb
on 13 Aug 2018 at 0:48

That would overwrite the variable which is ok if that's what's wanted...

   xlswrite(fileName,tabulate(C),sheetName,'B3');

will just output the result. Seems to work but while xlsread/write are always pretty slow, xlsread() of that particular output hung here first time and took some 30 sec to return the next. Don't know whassup w/ that...

Thanks for your help! It worked and I found each one of your advice helpful.

Sign in to comment.

1 Answer

Answer by KSSV
on 13 Aug 2018 at 4:25

  0 Comments

Sign in to comment.