Naming Table Variables of a File

21 views (last 30 days)
Fatih
Fatih on 27 Sep 2025 at 19:02
Commented: Fatih on 27 Sep 2025 at 19:58
I have a table 3x1 where each value has 6 seperate values. I want to name these 6 column names. As shown in the attached screenshot, I want to name 1 for example Data1, 2 Data2 etc.
Thanks for help in advance.

Accepted Answer

Torsten
Torsten on 27 Sep 2025 at 19:26
Edited: Torsten on 27 Sep 2025 at 19:31
load("T.mat")
T1 = splitvars(T);
T1 = renamevars(T1,["rows_1" "rows_2" "rows_3" "rows_4" "rows_5" "rows_6"],...
["Data1" "Data2" "Data3" "Data4" "Data5" "Data6"])
T1 = 3×6 table
Data1 Data2 Data3 Data4 Data5 Data6 ____________________________ __________ __________ _____ _______ __________ {'Proposed_AdaptiveMetaKNN'} {[0.5000]} {[0.5556]} {[1]} {[ 1]} {[6.4590]} {'Baseline_KNN_Grid' } {[ 1]} {[ 1]} {[5]} {[ 1]} {[1.5000]} {'Baseline_SVM_Linear' } {[0.5000]} {[0.3333]} {[5]} {[NaN]} {[ NaN]}
Alternatively:
T2 = renamevars(T,["rows"],["Data"]);
T2 = splitvars(T2)
T2 = 3×6 table
Data_1 Data_2 Data_3 Data_4 Data_5 Data_6 ____________________________ __________ __________ ______ _______ __________ {'Proposed_AdaptiveMetaKNN'} {[0.5000]} {[0.5556]} {[1]} {[ 1]} {[6.4590]} {'Baseline_KNN_Grid' } {[ 1]} {[ 1]} {[5]} {[ 1]} {[1.5000]} {'Baseline_SVM_Linear' } {[0.5000]} {[0.3333]} {[5]} {[NaN]} {[ NaN]}

More Answers (0)

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!