Finding the cell indices of a cell contains a specific text
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
B Janssen
el 27 de Jun. de 2017
Respondida: B Janssen
el 28 de Jun. de 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 comentarios
Respuesta aceptada
JESUS DAVID ARIZA ROYETH
el 27 de Jun. de 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 comentarios
Más respuestas (1)
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!