General question, should I use indexing
Mostrar comentarios más antiguos
I have a lot of field data and will be getting more in the future. I'm not great at matlab but I'm trying to get better and improve my code past the terrible (call in each file I want for 50 or more days of data) code I currently have. My question (in example form) is this: I have over 40 days of radiometer data, now I need to read in each day file and then manipulate the data, for example there are 4 columns with "flags" I need to write some code saying that when certain flags=1 then only grab (1:2:end,:) data. Would it be better to collate all of the days of data into one large matrix and try indexing by the date and messing with the data that way, or would it be better to write a for loop which reads in each day and manipulates the data in each day sequentially? Does it matter? I don't really know how to do either of these methods and I'm just trying to decide which method to spend my time on. So any advice would be appreceated.
2 comentarios
Stephen23
el 11 de Jul. de 2023
Generally it is easier to process data when it is stored in fewer arrays. More arrays just means more loops.
Perhaps a table might be suitable storage, then you can use inbuilt functions to process the groups of data:
Steven Lord
el 11 de Jul. de 2023
Because of this sentence fragment I'd suggest a timetable instead of a table.
"try indexing by the date"
They're very similar, and you can do most if not all of what you can do to a table with a timetable, but timetable also lets you do some time-based processing (like retime and synchronize) that would be trickier with a table.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Logical 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!