How count a number of rows in a table (meteorologica data)?

4 Ansichten (letzte 30 Tage)
My goal is to create an array that counts the number of rows each day of the year, to identify which days I should include blank lines in the final table. Some of the days have the correct amount of points (48 per day), so some do not. I wrote this script with the intention of doing but I’m not getting it. Could someone help me?
doy = data (:,3); % Column of the Julian Days (1,2,3,...,366). Each day has the value repeated by 48 rows of the matrix (data).
cont_doy = zeros(366,2); % matrix that receives the row count each day
cont_doy(:,1) = 1:366;
for i = 1:366;
id = find (data(:,3) == i);
cont_doy(:,2) = size(id, 1)
end

Akzeptierte Antwort

Star Strider
Star Strider am 8 Sep. 2021
I have no idea what you are actually doing. If you want to interpolate the rows in the table, consider converting it to a timetable and then use retime to do the interpolation.
.
  3 Kommentare
Image Analyst
Image Analyst am 8 Sep. 2021
You can use height to get the number of rows in a table
rowsInTable = height(yourTable);
If you have an array instead of a table, you can use size
rowsInTable = size(yourArray, 1);
Star Strider
Star Strider am 8 Sep. 2021
@Kaleb Ribeiro — The retime funciton will interplate, and fill the missing data with interpolated values or a constant (such as NaN), so that the days all have the same numbers of entries.
.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Type Conversion finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by