Exporting code from MATLAB and producing a table in Excel.

조회 수: 2 (최근 30일)
Wisam Aboubaker
Wisam Aboubaker 2020년 6월 25일
답변: Maadhav Akula 2020년 7월 1일
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
Wisam Aboubaker
Wisam Aboubaker 2020년 6월 25일
What you said.
dpb
dpb 2020년 6월 26일
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.

댓글을 달려면 로그인하십시오.

답변 (1개)

Maadhav Akula
Maadhav Akula 2020년 7월 1일

카테고리

Help CenterFile Exchange에서 Spreadsheets에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by