For loop based on entries in Dataset
Mostrar comentarios más antiguos
Good day,
I have a dataset in Matlab with 100,000 or so rows, and about 50 columns. First column is Date ('dd-mm-yyyy hh:mm' format), second column is Name, and remainder of the columns are all information captured at that specific time.
I can use a for loop and interate through all line, as follows:
for i = 1:size(Name,1)
end
But it while take a long time to run. So to reduce compiling time, i would like to first pre-set names (Axel, Leon, Louis, Harvey) and set a fixed date range (say 01-01-2020 -till 01-02-2020). I want to neglect all lines outside of this date range, and afterwards want a for loop where first all lines with Name Axel are evaluated, and output is created. Than all lines with Name 'Leon', etc. etc.
(Was thinking a double for loop with For Axel, For these dates do .... next but couldn't figure it out)
Needless to say I am not an expert in Matlab (yet).
Thanks in advance for your kind assistance.
Rgrds,
1 comentario
Rik
el 20 de Ag. de 2020
You will have to parse all lines and extract the date and name. Your idea would then only make sense if the parsing of the rest of the row is very time-intensive.
For those names: store them in a cell array and you can trivially loop through each name.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!