Why is the workspace not displaying values?
Show older comments
Hello everyone!
I am working on a boxplot code with maximum and minimum temperatures. For some reason, I am not getting anything in my DailyTMAX_1, DailyTMAX_2, DailyTMAX_3, etc... I just receive open brackets [ ]. The same is happening with some of my CSV files, but other ones do work. I do not know it it is something on my code or if it is the CSV data file. Hope anyone can help me with this.
This is part of the code:
StationRawData = readtable('Socorro.csv');
DateInfo = StationRawData.DATE;
%To find start and end date and add 1900s or 2000s (boxplot)
target = datetime("12/31/0099",'InputFormat','MM/dd/yyyy');
column=logical(DateInfo==target);
row=find(column) %row with last date from 1999
[year, month, day] = ymd(DateInfo);
year(1:row) = year(1:row) + 1900;
year(row+1:S(1)) = year(row+1:S(1)) + 2000;
DateInfo = datetime(year, month, day);
% For 30 year intervals (1930-1959)
upper_limit = datetime("12/31/1959",'InputFormat','MM/dd/yyyy');
lower_limit = datetime("1/1/1930",'InputFormat','MM/dd/yyyy');
column2=logical(DateInfo>lower_limit&DateInfo<upper_limit); %find dates between this range
row2=find(column2);
startrow=min(row2);
endrow=max(row2);
Datenumber = datenum(DateInfo(startrow:endrow));
YearlyPR_1 = StationRawData.PRCP(startrow:endrow);
DailyTMAX_1 = StationRawData.TMAX(startrow:endrow);
DailyTMIN_1 = StationRawData.TMIN(startrow:endrow);
hold on
x = [DailyTMAX_1; DailyTMAX_2; DailyTMAX_3];
g1 = repmat({'1931-1960'},10896,1);
g2 = repmat({'1961-1990'},10672,1);
g3 = repmat({'1991-2020'},6687,1);
g = [g1; g2; g3];
boxplot(x,g)
Thank you!

Accepted Answer
More Answers (0)
Categories
Find more on Exploration and Visualization in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!