Extract values from a data table and create a new table
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Nuria Andreu
am 6 Jul. 2022
Kommentiert: Nuria Andreu
am 9 Jul. 2022
Hello! I have a data file with multiple data points including date and precipitation values (range from 0.1 inches to 2 inches).
I want to extract all of the precipitation values over 1 inch and store them in a new table with its proper date. Anyone has some tips or ideas on how to do this? I gave up after multiple tries.
Thank you in advance!

2 Kommentare
Akzeptierte Antwort
Chunru
am 7 Jul. 2022
T = readtable("https://www.mathworks.com/matlabcentral/answers/uploaded_files/1057240/Sta_Teresa.csv");
T1 = T(T.PRCP > 1, :)
Weitere Antworten (1)
dpb
am 7 Jul. 2022
What did you try? Have you looked at the "Getting Started" section on array indexing/addressing; specifically logical indexing?
PLevel=1; % the magic constant -- don't bury in code, use variables
tPrecipGreater=tPrecip(tPrecip.PRCP>Plevel,:);
That's it...
Siehe auch
Kategorien
Mehr zu Data Import and Analysis finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!