Changing names and removing quotes in row2vars output table

7 visualizaciones (últimos 30 días)
KarolN
KarolN el 25 de En. de 2022
Comentada: dpb el 27 de En. de 2022
I have generated an output table with iteration data from several equations:
I transposed the table for greater viewing comfort with splitvars and row2vars:
But now, I have some new row and column names, plus those ugly quote marks.
Now: how to replace Var1, Var2, Var3 etc with 'h', 'A', 'P', 'R', 'Energy E' etc.?
How to get rid of that 'Original/VariableNames' in top left corner?
And how to remove quotations from data?

Respuesta aceptada

dpb
dpb el 25 de En. de 2022
As always, if you would show the code you used to create the table, it would make our job much easier...
The table command and friends (like array2table) have the named input parameter 'VariableNames' that you can use to create the names you wish on creation, or you can use the tableName.Properties.VariableNames property to assign the names after creation.
However, from the content of the table, it appears you did not use the "ReadVariableNames,1" parameter in order for whichever of the functions you did use that would have read the first record as variable names and given you those automagically.
Doing that would then let all the other data be treated as numeric and then being numbers, the apostrophes will go away.
The apostrophes are a display feature of MATLAB command window and cannot be removed from fields that are strings; they are the visual clue as to what type of variable is in the given column; a cellstr and char string variable are also shown as either in curly braces or single quotes. But, if you do the above and fix it to read the first record as variable names, then they will be seen as numeric and all will be well in the world.
  4 comentarios
KarolN
KarolN el 27 de En. de 2022
@dpb Thank you very much for solving my problem!
Just for your curiosity:
Parameters variable is neccessary, because it is the only way to have greek letters as table names.
fromSection was a name of a vector, which gathers the output from 9 equations. When I transposed the table MATLAB had to split it to preserve the logic of the output I guess
dpb
dpb el 27 de En. de 2022
"... because it is the only way to have greek letters as table names."
Yech! Another terrible thing to have to then enter in order to use the data alll for a little visual bling.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Productos


Versión

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by