How to Add custom Excel column values in Excel file based on conditional contents?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
ahmed obaid
le 2 Avr 2017
Réponse apportée : Andrei Bobrov
le 3 Avr 2017
Dear all
i have a large Excel file involve (1000+) countries and their states and variables ... i need to to add column in the last called (label) which involve numeric values based on column A content .. for example if column A include UK then, the values of label column is (1) for all UK rows ... and label value is (2) for all USA rows...and so on for others..
Country-name(A1) State-name(B1) ..... variables names.... (Lables)
UK WSG ....values .............. 1
USA FLO ......................... 2
UK SLE ......................... 1
PLG SEO ......................... 3
etc.. etc..
So kindly is this possible to be implement in matlab? thanks
0 commentaires
Réponse acceptée
Andrei Bobrov
le 3 Avr 2017
T = readtable('yourdataexcel.xlsx');
[~,~,c] = unique(T(:,1),'stable');
Tout = [T,table(c,'Variablenames',{'Label'})];
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!