How to read excel data include specific word? cell?
Afficher commentaires plus anciens
Hi, all
[~,~,data] = xlsread('kpmarch.xlsx' );
data=[data(:,1) data(:,3) data(:,4) ];
There's 6columns in my excel file and I took A,C,D 3colomns form excel
next step, i only wanna take rows which include 'Planetary' in column C(OBSRVT_NM)
How can i do this..
Réponse acceptée
Plus de réponses (1)
Walter Roberson
le 2 Août 2022
It is not possible to read rows selectively, other than by consecutive position.
You will need to do something such as
mask = ismember(data(:,3), 'Planetary');
subset = data(mask, [1 4]);
Note: we recommend that you switch to readtable()
data = readtable('kpmarch.xlsx');
mask = ismember(data.OBSRVT_NM, 'Planetary');
subset = data(mask, [1 4]);
Then subset{:,2} would be datetime objects.
Your xlsx file is odd: all of your numbers are represented as text.
1 commentaire
Nicolas Alfred
le 2 Août 2022
Catégories
En savoir plus sur Spreadsheets dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!