Clear Filters
Clear Filters

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

6 views (last 30 days)
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?

Answers (2)

Steven Lord
Steven Lord on 6 Jun 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 on 8 Jun 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}

Categories

Find more on Tables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!