Borrar filtros
Borrar filtros

How to transpose a table of double values without the doubles getting converted to integers?

6 visualizaciones (últimos 30 días)
I want to transpose a table, so I have used table2array() and rows2vars() functions. Both of them transpose the table but cast each double value to int64. How can I transpose it but keep the double values as they are?

Respuestas (2)

Steven Lord
Steven Lord el 6 de Jun. de 2020
That tells me your table contains both int64 and double data. When you combine the table values into one array with table2array the double data is converted to int64 as stated on this documentation page.
There's no need to convert your table into an array. Just use rows2vars on its own.

Walter Roberson
Walter Roberson el 8 de Jun. de 2020
NewTable = cell2table(cellfun(@(v) {v}, table2cell(YourTable).','uniform',0))
Note that each entry will be turned into a cell. This is needed in order to preserve the appropriate datatype. So for example,
NewTable{3,1}{1}
to get at the content of what used to be Table{1,3}

Categorías

Más información sobre Tables en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by