add column in table
92 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
T= struct2table(G);
c=1:length(T);
c=c';
i want to add c as new column of T!
0 Commenti
Risposta accettata
Voss
il 11 Lug 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 Commenti
Voss
il 12 Lug 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])
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Tables in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!