add column in table
92 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
T= struct2table(G);
c=1:length(T);
c=c';
i want to add c as new column of T!
0 commentaires
Réponse acceptée
Voss
le 11 Juil 2023
G = struct('ones',{1 1 1 1},'twos',{2 2 2 2}); % for example
T= struct2table(G);
c=1:height(T); % use height
c=c';
T.new_column = c
7 commentaires
Voss
le 12 Juil 2023
[Is it] possible [to] move c in the first column?
Yes, see below:
G = struct('ones',{1 1 1 1},'twos',{2 2 2 2}); % for example
T= struct2table(G);
c=1:height(T); % use height
c=c';
T.new_column = c;
T = T(:,[end 1:end-1])
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Tables dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!