Clear Filters
Clear Filters

Why is the workspace not displaying values?

4 views (last 30 days)
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');
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
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];
Thank you!

Accepted Answer

Walter Roberson
Walter Roberson on 21 Jul 2021
StationRawData = readtable('Socorro.csv');
when you use readtable() with a date that has a 2 digit year, then
  • If you read a two-digit year number and specify the format as y or yy, then the pivot year determines the century to which the year belongs.
The default pivot year is year(datetime('now'))-50
So years given as 71 to 99 would be assigned as 1900, and 00 to 70 would be assigned to 2000.
Because of this, you would not have any datetimes in the 0099 range. You would have had to overridden the datetime parsing to use 'uu' instead of 'yy' to do the transformation that way.

More Answers (0)


Find more on 2-D and 3-D Plots 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!