Combine multiple tables into one so that it can be write into one excel sheet

I have a Matlab function that generates multiple tables, each table is quite different from the others, whether in size or in variable names. Is that possible that I combine and shape these tables into one big table or matrix(whatever) as long as all the tables can be returned to one Excel sheet with one call?

Answers (1)

You can combine the tables, but if you have different variables in each one you'd have to fill in large chunks with missing data.
Why not write to the spreadsheet using a range?

5 Comments

It’s because I’m trying to convert the function into Excel add-in. I heard that to use Excel add-in, this function should populate only one output, so I should combine all my output tables into one. If I convert tables into arrays and put the new arrays into one big matrix. How can I make the missing values not displayed as NaN? I want them to look like blank after writing to Excel.
If the add-in is intended to return a numeric matrix, then you cannot leave anything blank.
If the add-in MATLAB code is permitted to use ActiveX to drive Excel, then you can use activexserver() on the MATLAB side and give the link commands that can write into arbitrary selection regions.
Thank you so much! What if I would like to return a cell array which contains both text and numbers? Could Excel add-in populate outputs in such data type?
Sorry, I do not know how excel add-in work. I do not have Excel on windows to test with.

Sign in to comment.

Asked:

on 13 Sep 2018

Commented:

on 14 Sep 2018

Community Treasure Hunt

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

Start Hunting!