How to change the name of a table and its headings?
9 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi
I am trying to change the name of table to Time duration of vehicle speed from Time_duration_vehicle_speed and its two column headings to Interval of speed (rpm) and Duration of speed (s) (all wihtout any underscores). I am not sure how to type the words properly or what the format is to get it be displayed in a normal format with spaces.
Any help would be appreciated, Thankyou.
0 Kommentare
Antworten (2)
Star Strider
am 31 Jul. 2023
Bearbeitet: Star Strider
am 9 Aug. 2023
This should work in R2020b —
Interval_of_speed_rpm = randn(5,1);
Duration_of_speed_sec = randn(5,1);
Time_duration_vehicle_speed = table(Interval_of_speed_rpm, Duration_of_speed_sec)
VN = Time_duration_vehicle_speed.Properties.VariableNames
Time_duration_vehicle_speed.Properties.VariableNames = cellfun(@(x)strrep(x, '_', ' '), VN, 'Unif',0)
EDIT — (9 Aug 2023 at 11:11)
There cannot be any spaces in the name of the table.
.
0 Kommentare
Voss
am 31 Jul. 2023
The name of the table has to be a valid MATLAB variable name ("Time_duration_vehicle_speed" is OK; "Time duration vehicle speed" is not), but the name of the variables in the table can be specified when you create the table. Here's one way to do that:
Interval_Of_Speed_rpm = rand(8,1);
Duration_Of_Speed_s = rand(8,1);
% Time_duration_vehicle_speed = table(Interval_Of_Speed_rpm,Duration_Of_Speed_s)
Time_duration_vehicle_speed = table(Interval_Of_Speed_rpm,Duration_Of_Speed_s, ...
'VariableNames',{'Interval (RPM)','Duration (s)'})
2 Kommentare
Siehe auch
Kategorien
Mehr zu Logical 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!