Finding the cell indices of a cell contains a specific text
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
B Janssen
le 27 Juin 2017
Réponse apportée : B Janssen
le 28 Juin 2017
Hi, I am working with a large CSV file containing blood pressure data (approx 14 million datapoints). I managed to import the data successfully, creating 2 cell arrays (NUMBERS and TEXT). One contains the actual numbers that I want to use for my calculations (NUMBERS), the other (TEXT) contains the information (as a string) about the associated time-points. Since NUMBERS and TEXT run parallel, I can use the cell indices from TEXT, to get to the data in NUMBERS for further computation.
What I am trying to figure out is how to find a specific string in TEXT; e.g. what are the indices of a time point (e.g. 12:00:00)? I started to work with 'strfind' but this only gives me either 0 or 1; not the cell indices that I need. Moreover, the strings in TEXT contain 'Value, Time, Date' (eg. '103.9685,10:27:37,2016-02-03') which means that I only need the middle portion '10:27:37'of the string.
Can anyone provide me with insights/directions as to what strategy/method is best to use in this case?
Thanks! Barry
0 commentaires
Réponse acceptée
JESUS DAVID ARIZA ROYETH
le 27 Juin 2017
I can help you with what you need in this example, it will give you the indices you need :
TEXT={'103.9685,10:27:37,2016-02-03','103.9685,12:00:00,2016-01-03' '103.9685,11:27:37,2016-02-03' '103.9685,12:00:00,2016-02-03' };
indices=find(cell2mat(cellfun(@(x) ~isempty(strfind(x,'12:00:00')),TEXT,'UniformOutput',false)));
0 commentaires
Plus de réponses (1)
Voir également
Catégories
En savoir plus sur Characters and Strings 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!