Azzera filtri
Azzera filtri

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 visualizzazioni (ultimi 30 giorni)
(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

Risposte (1)

Walter Roberson
Walter Roberson il 6 Giu 2019
  1 Commento
Nasir
Nasir il 6 Giu 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)

Accedi per commentare.

Categorie

Scopri di più su Data Import from MATLAB in Help Center e File Exchange

Prodotti


Release

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by