How to add columns with fixed values to their exact position in the table
4 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Akashdeep Kaur
le 18 Juil 2022
Commenté : Abderrahim. B
le 18 Juil 2022
Hello, I have a table with 16 columns. Some columns have variable value and some have fixed value.
I fixed their values like:
simtable.datacenters(:)="Cloud_1";
Now, This column is at no. 4 in my table. but, when printing output it gets printed at last.
I also want to generate its excel sheet but the columns with fixed values are not added to excel sheet.
Thank you.
0 commentaires
Réponse acceptée
Abderrahim. B
le 18 Juil 2022
Modifié(e) : Abderrahim. B
le 18 Juil 2022
Hi,
Use addvars instead of dot notation to add columns to your table.
Demo:
load patients
T = table(Age,Gender,Smoker) ;
% add a new column to T table before Age
T = addvars(T,LastName,'Before','Age')
Hope this helps
10 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets 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!