After writing a numeric matrix in excel using writematrix, the format of each cell in excel is text and not a number.

6 次查看(过去 30 天)
In excel advanced options I have selected not to use the system delimiters. I use "." to delimit decimals and ", " to delimit thousands.
  2 个评论
Jan
Jan 2022-3-7
编辑:Jan 2022-3-7
In which format do you write the output file by writematrix? Please provide a small working example, which reproduces the problem and mention, what you want to get instead. Currently your message is a statement and we have to guess, what you are asking for.
Fernando Gandía Agüera
Ok. An example of what I'm using:
writematrix(DATA,filename,'Sheet',sheet1,'Range',A1).
The matrix DATA, is previously defined with numbers.
In the writematrix statement I don't specify a specific format, I understand that if the DATA matrix is a number matrix, it should record in excel numbers, but it is not.The format written in excel is text. I think I have followed the indications in the matlab help about the writematrix statement.
Thanks

请先登录,再进行评论。

回答(1 个)

Harimurali
Harimurali 2023-11-3
Hi Fernando,
I understand that you want to write the data in the number matrix “DATA” to an Excel sheet, but the data is written to Excel as text instead of being recorded as Excel numbers.
I tried reproducing the issue at my end, but it was not reproducible. An alternate to this is using Spreadsheet Link software, which enables access to the MATLAB environment from an Excel spreadsheet.
Please follow these steps to install Spreadsheet Link and import data from MATLAB in Excel:
  • Spreadsheet Link can be installed using the add-ons manager in MATLAB in the following way:
HOME -> Add-Ons -> Get Add-Ons -> Search for “Spreadsheet Link” and click install.
  • Refer to the following documentation for setting up the Spreadsheet Link Add-In in Microsoft Excel:
  • Open a new spreadsheet and enter the following command:
=MLGetMatrix(DATA, "SheetName!Cell"), where “SheetName” is the name of the sheet where the data needs to be imported to beginning at the “Cell” specified.
For example: =MLGetMatrix(DATA, "Sheet1!A5")
Please refer the following links for more information on Spreadsheet Link:
Hope this helps.

Community Treasure Hunt

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

Start Hunting!

Translated by