Changing names and removing quotes in row2vars output table
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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?
0 Kommentare
Akzeptierte Antwort
dpb
am 25 Jan. 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 Kommentare
dpb
am 27 Jan. 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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!