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

6 views (last 30 days)
In excel advanced options I have selected not to use the system delimiters. I use "." to delimit decimals and ", " to delimit thousands.
  2 Comments
Jan
Jan on 7 Mar 2022
Edited: Jan on 7 Mar 2022
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
Fernando Gandía Agüera on 7 Mar 2022
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

Sign in to comment.

Answers (1)

Harimurali
Harimurali on 3 Nov 2023
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!