![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/466190/image.png)
Why are the matrix numbers changing while converting table to matrix?
7 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
matlabuser
il 20 Dic 2020
Commentato: matlabuser
il 20 Dic 2020
I have a table named "tres_big" of size (324 x 65). It's a time series dataset. I wanted it to convert to a matrix without the "Date" column so I removed that first. But when I applied the "table2array" function, the elements of the several columns changed to 0.
% removes the "Date" column from "tres_big"
tresc_big= removevars(tres_big,{'Date'});
% convert into matrix
data_big = table2array(tresc_big);
This is the original table:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/466175/image.png)
This is what happens after I convert into matrix
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/466185/image.png)
What can I do to fix the problem? I would like to have the original numbers as in the table. I would appreciate any help.
0 Commenti
Risposta accettata
Cris LaPierre
il 20 Dic 2020
They are not changing, but you must have some large numbers in your data. When you convert the table to a matrix, it expresses all the numbers using the same format. Note the multiplier under data_big (
x). This means everything is you matrix is times 100,000. This causes your smaller values to not have anything but zeros appear in the display, though the values are still there.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/466190/image.png)
You can modify the command window output display with the format function. See the format options here.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Tables in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!