I have a .txt file with all the temperature of a city in different years. I need to plot maximum, minimum and medium of one month from input, per each year. Example:
input month = 8month 8 year 1996 --> max, min, meanmonth 8 year 1997 --> max, min, meanmonth 8 year 1998 --> max, min, mean (all in one graph)
I've tried this:
clear all%load file in a matrix
mt=load('LONDON.txt');%I save only positive value because sometimes the file doesn't have value in a row
pos = mt(mt(:,4) > 0,:);%input from keyboard of the month that I want to plot
month= input('\n enter a month\n');%new matrix with all the positive value of the chosen month
fin = pos(pos(:,1) == month,:);%matrix value in a table
T = array2table(fin, 'v',{'month','day','year','temperature'});%value of each year
res95 = T(T.month==1995,:);res96 = T(T.month==1996,:);res97 = T(T.month==1997,:);res98 = T(T.month==1998,:);res99 = T(T.month==1999,:);res00 = T(T.month==2000,:);res01 = T(T.month==2001,:);res02 = T(T.month==2002,:);res03 = T(T.month==2003,:);res04 = T(T.month==2004,:);res05 = T(T.month==2005,:);res06 = T(T.month==2006,:);res07 = T(T.month==2007,:);res08 = T(T.month==2008,:);res09 = T(T.month==2009,:);res10 = T(T.month==2010,:);res11 = T(T.month==2011,:);res12 = T(T.month==2012,:);res13 = T(T.month==2013,:);res14 = T(T.month==2014,:);
now I have different tables only with the month chosen. How can I plot theme all in one graph ? Thank you.
Best Answer