MATLAB Answers

How do i load massive multi-variable files and manipulate the data?

21 views (last 30 days)
Christopher Van Horn
Christopher Van Horn on 28 Sep 2020 at 14:09
Answered: Sudheer Bhimireddy on 28 Sep 2020 at 15:45
To be open and honest this is a homework problem that has been graded. I want to know what I did wrong and how to fix it, I do not like unfinished work. I am a disabled veteran and non-traditional student. Before this class I had a max of 2 weeks education in programming in matlab. I want to learn this.
2. Given the above record of precipitation at a station, calculate the probability of
precipitation at that location using hourly data. Aggregate the data to daily
resolution and repeat the calculation of the probability of precipitation. Report
and explain the results.
3. Write a Matlab function for a numerical estimation of an integral of a userprovided
single-valued function between limits a and b (also user-provided).
Demonstrate that the function works.
I never got to the function because i could not get the data to load. Strawberry.txt is the simplified data file and homework_3_data_drop.txt is the original downloaded data from the National Centers for Environmental Information (NCEI). hw3_datez.m is my code built from trying to manipulate others work.
After about 30 hours of video for assignment 4 and another 26 hours of manipulation I was able to download a .txt file into readable data. (hw_4incomplete.m). again this is a past assignment though not graded yet. which is based on the all_in_one.txt. In this one I tried to add rownames so i could indicate what i needed.
I am actively seeking a tutor in my area of Iowa city, but so far nothing. any help would be appreciated deeply. Screenshot (39) shows the assignments are closed and includes my typing of this question so there is no question I am not cheating.

  0 Comments

Sign in to comment.

Accepted Answer

Sudheer Bhimireddy
Sudheer Bhimireddy on 28 Sep 2020 at 15:45
Your approach is correct. Perhaps the below code might help.
% Read the txt file
data = readtable('Strawberry.txt','Format','%f%s%s%f');
% Read the time columns and concatenate
time = strcat(data.Var2,data.Var3);
% Read the Rainfall column
Rainfall = data.Var4;
% Create MATLAB datetime array
T = datetime(time,'InputFormat','yyyyMMddHH:mm');
% Using array2timetable to create a TimeTable with Rainfall as the variable
% and T as the corresponding time
TT = array2timetable(Rainfall,'RowTimes',T);
% Your calculations
TTsum = retime(TT,'yearly','sum');
TTavg = retime(TT,'yearly','mean');
TTmax = retime(TT,'yearly','max');
TTmin = retime(TT,'yearly','min');

  0 Comments

Sign in to comment.

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by