Exporting code from MATLAB and producing a table in Excel.

8 visualizzazioni (ultimi 30 giorni)
I need to create a 3x2 arrangement of headers using the MATLAB function writetable. I need to replicate the picture below and include the same color code as well. I am having trouble doing so. The code is also attached below.
dataTable.Properties.RowNames % obtains the row names from the table
dataTable.Properties.VariableNames % obtains the variables
annotations.rowHeader % Obtains the Row Header from the table
annotations.columnHeader % Obtains the Column Header from the table
annotations.fileName % Obtains the File Name
%% Write to Excel Spreadsheet
writetable(dataTable,[annotations.fileName,'.xlsx']) % writes the table into an excel file
writetable(dataTable,[annotations.rowHeader,'xlsx']) % locates the row Headers from excel file
  5 Commenti
dpb
dpb il 26 Giu 2020
What, precisely?
I recommended that if you wanted an Excel spreadsheet with a fancy set of colorings, etc., that aren't part of the builtin features of the high-level tools in MATLAB to write to Excel files, the expedient way to do so is to make those changes in Excel (you appear to already have one, so that shouldn't be hard) and save that sheet as a template spreadsheet.
Then, open/create a new workbook from that template when you need it and use writetable to write the data to it with the formatting already in place.
Look at the Excel help files or DAGS to learn how to use Excel...
Doing those changes in MATLAB will have to be done by using the COM engine; there aren't functions with those in ML -- ML lets you read/write data to/from Excel but it's not TMW's job to make every piece of Excel available.

Accedi per commentare.

Risposte (1)

Maadhav Akula
Maadhav Akula il 1 Lug 2020

Community Treasure Hunt

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

Start Hunting!

Translated by