How te delete certain coulmns from a table with respect to the header
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I need to delete all (AA) columns from a huge table like this
AA B AA B C .. G
1 1 1 1 1 .. 1
3 0 2 5 6 .. 5
4 5 8 9 6 .. 0
0 2 8 8 7 .. 2
Thanks in advance!
0 Kommentare
Antworten (1)
Voss
am 16 Apr. 2022
I'm unable to create a table with more than one column called 'AA'
AA = [1; 3; 4; 0];
B = [1; 0; 5; 2];
table(AA,B,AA)
So I'll assume you have a cell array:
T = {'AA' 'B' 'AA' 'C'; 1 1 1 1; 3 0 2 6; 4 5 8 6; 0 2 8 7}
% now delete the columns of T whose element in the first row is 'AA':
T(:,strcmp(T(1,:),'AA')) = []
0 Kommentare
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB 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!