Effacer les filtres
Effacer les filtres

How to import and use specific columns and rows from excel, based on column titles (and some row value ranges) that can vary from file to file

15 vues (au cours des 30 derniers jours)
(looking at the attached example excel file ) i want to e able to select a specific column in this case lets say column B , but if another file is used where B is still a title but not in the same location it will still be able to improt the B column automatically. then i want to be able to do calculations in column B based on row values (if a value in column A is a certain value it will only do calculations in those rows); for example if in column A a value has 22 in the B column the same rows will be used for calculations or at least displayed in order to do the calculations . the purpose is to make this code compatible and adaptable with other excell files Capture.PNG

Réponses (1)

Walter Roberson
Walter Roberson le 6 Juin 2019
  1 commentaire
Nasir
Nasir le 6 Juin 2019
what would/can i do if instead of simple column headers i have more complicated headers such as "1234 Car Speed ", how would the be put into matlab as proper notation. As i do not have controll over what the column titles are.
t1 = readtable('test1.xlsx');
mask = t1.A == 22;
B22 = t1.B(mask);
% VS
t1 = readtable('test1.xlsx')
mask = t1.1234 Car Speed == 22
B22 = t1.B(mask)

Connectez-vous pour commenter.

Catégories

En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange

Produits


Version

R2014b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by