data = readtable('SpentinUSDollar.xlsx')
Warning: Column headers from the file were modified to make them valid MATLAB identifiers before creating variable names for the table. The original column headers are saved in the VariableDescriptions property.
Set 'VariableNamingRule' to 'preserve' to use the original column headers as table variable names.
data =
Date SAR USDollar TotalOf2015 TotalOf2016 TotalOf2017 TotalOf2018 TotalOfAllYears
___________ ____ ________ ___________ ___________ ___________ ___________ _______________
23-Aug-2015 5000 1332.5 8528.3 15911 15058 8261.8 47758
09-Sep-2015 1000 266.51 NaN NaN NaN NaN NaN
16-Sep-2015 6000 1599.1 3.7522 NaN NaN NaN NaN
27-Sep-2015 3000 799.53 NaN NaN NaN NaN NaN
01-Oct-2015 3000 799.53 NaN NaN NaN NaN NaN
08-Oct-2015 1000 266.51 NaN NaN NaN NaN NaN
18-Oct-2015 6000 1599.1 NaN NaN NaN NaN NaN
25-Oct-2015 1000 266.51 NaN NaN NaN NaN NaN
01-Nov-2015 3000 799.53 NaN NaN NaN NaN NaN
24-Nov-2015 3000 799.53 NaN NaN NaN NaN NaN
09-Dec-2015 3000 799.53 NaN NaN NaN NaN NaN
10-Jan-2016 1500 399.76 NaN NaN NaN NaN NaN
13-Jan-2016 2000 533.02 NaN NaN NaN NaN NaN
18-Jan-2016 3500 932.78 NaN NaN NaN NaN NaN
31-Jan-2016 1500 399.76 NaN NaN NaN NaN NaN
21-Feb-2016 3500 932.78 NaN NaN NaN NaN NaN
Udate2015 = year(data{:,1}) == 2015;
tdate2015 = data(Udate2015,:)
tdate2015 =
Date SAR USDollar TotalOf2015 TotalOf2016 TotalOf2017 TotalOf2018 TotalOfAllYears
___________ ____ ________ ___________ ___________ ___________ ___________ _______________
23-Aug-2015 5000 1332.5 8528.3 15911 15058 8261.8 47758
09-Sep-2015 1000 266.51 NaN NaN NaN NaN NaN
16-Sep-2015 6000 1599.1 3.7522 NaN NaN NaN NaN
27-Sep-2015 3000 799.53 NaN NaN NaN NaN NaN
01-Oct-2015 3000 799.53 NaN NaN NaN NaN NaN
08-Oct-2015 1000 266.51 NaN NaN NaN NaN NaN
18-Oct-2015 6000 1599.1 NaN NaN NaN NaN NaN
25-Oct-2015 1000 266.51 NaN NaN NaN NaN NaN
01-Nov-2015 3000 799.53 NaN NaN NaN NaN NaN
24-Nov-2015 3000 799.53 NaN NaN NaN NaN NaN
09-Dec-2015 3000 799.53 NaN NaN NaN NaN NaN
Udate2015 = year(data{:,1}) == 2015;
tdate2015 = data(Udate2015,:)
tdate2015 =
Date SAR USDollar TotalOf2015 TotalOf2016 TotalOf2017 TotalOf2018 TotalOfAllYears
___________ ____ ________ ___________ ___________ ___________ ___________ _______________
23-Aug-2015 5000 1332.5 8528.3 15911 15058 8261.8 47758
09-Sep-2015 1000 266.51 NaN NaN NaN NaN NaN
16-Sep-2015 6000 1599.1 3.7522 NaN NaN NaN NaN
27-Sep-2015 3000 799.53 NaN NaN NaN NaN NaN
01-Oct-2015 3000 799.53 NaN NaN NaN NaN NaN
08-Oct-2015 1000 266.51 NaN NaN NaN NaN NaN
18-Oct-2015 6000 1599.1 NaN NaN NaN NaN NaN
25-Oct-2015 1000 266.51 NaN NaN NaN NaN NaN
01-Nov-2015 3000 799.53 NaN NaN NaN NaN NaN
24-Nov-2015 3000 799.53 NaN NaN NaN NaN NaN
09-Dec-2015 3000 799.53 NaN NaN NaN NaN NaN
Udate2016 = year(data{:,1}) == 2016;
tdate2016 = data(Udate2016,:)
tdate2016 =
Date SAR USDollar TotalOf2015 TotalOf2016 TotalOf2017 TotalOf2018 TotalOfAllYears
___________ ____ ________ ___________ ___________ ___________ ___________ _______________
10-Jan-2016 1500 399.76 NaN NaN NaN NaN NaN
13-Jan-2016 2000 533.02 NaN NaN NaN NaN NaN
18-Jan-2016 3500 932.78 NaN NaN NaN NaN NaN
31-Jan-2016 1500 399.76 NaN NaN NaN NaN NaN
21-Feb-2016 3500 932.78 NaN NaN NaN NaN NaN
13-Mar-2016 3500 932.78 NaN NaN NaN NaN NaN
01-May-2016 3500 932.78 NaN NaN NaN NaN NaN
08-May-2016 3000 799.53 NaN NaN NaN NaN NaN
01-Jun-2016 3000 799.53 NaN NaN NaN NaN NaN
13-Jun-2016 2000 533.02 NaN NaN NaN NaN NaN
03-Jul-2016 3500 932.78 NaN NaN NaN NaN NaN
10-Jul-2016 1000 266.51 NaN NaN NaN NaN NaN
24-Jul-2016 3000 799.53 NaN NaN NaN NaN NaN
28-Aug-2016 1000 266.51 NaN NaN NaN NaN NaN
04-Sep-2016 6500 1732.3 NaN NaN NaN NaN NaN
27-Sep-2016 3500 932.78 NaN NaN NaN NaN NaN
Udate2016 = year(data{:,1}) == 2016;
tdate2016 = data(Udate2016,:)
tdate2016 =
Date SAR USDollar TotalOf2015 TotalOf2016 TotalOf2017 TotalOf2018 TotalOfAllYears
___________ ____ ________ ___________ ___________ ___________ ___________ _______________
10-Jan-2016 1500 399.76 NaN NaN NaN NaN NaN
13-Jan-2016 2000 533.02 NaN NaN NaN NaN NaN
18-Jan-2016 3500 932.78 NaN NaN NaN NaN NaN
31-Jan-2016 1500 399.76 NaN NaN NaN NaN NaN
21-Feb-2016 3500 932.78 NaN NaN NaN NaN NaN
13-Mar-2016 3500 932.78 NaN NaN NaN NaN NaN
01-May-2016 3500 932.78 NaN NaN NaN NaN NaN
08-May-2016 3000 799.53 NaN NaN NaN NaN NaN
01-Jun-2016 3000 799.53 NaN NaN NaN NaN NaN
13-Jun-2016 2000 533.02 NaN NaN NaN NaN NaN
03-Jul-2016 3500 932.78 NaN NaN NaN NaN NaN
10-Jul-2016 1000 266.51 NaN NaN NaN NaN NaN
24-Jul-2016 3000 799.53 NaN NaN NaN NaN NaN
28-Aug-2016 1000 266.51 NaN NaN NaN NaN NaN
04-Sep-2016 6500 1732.3 NaN NaN NaN NaN NaN
27-Sep-2016 3500 932.78 NaN NaN NaN NaN NaN
Udate2017 = year(data{:,1}) == 2017;
tdate2017 = data(Udate2017,:)
tdate2017 =
Date SAR USDollar TotalOf2015 TotalOf2016 TotalOf2017 TotalOf2018 TotalOfAllYears
___________ ____ ________ ___________ ___________ ___________ ___________ _______________
23-Jan-2017 5000 1332.5 NaN NaN NaN NaN NaN
12-Feb-2017 2000 533.02 NaN NaN NaN NaN NaN
28-Feb-2017 3500 932.78 NaN NaN NaN NaN NaN
30-Mar-2017 4500 1199.3 NaN NaN NaN NaN NaN
30-Apr-2017 5000 1332.5 NaN NaN NaN NaN NaN
29-May-2017 5000 1332.5 NaN NaN NaN NaN NaN
27-Jun-2017 4500 1199.3 NaN NaN NaN NaN NaN
30-Jul-2017 6000 1599.1 NaN NaN NaN NaN NaN
29-Aug-2017 7000 1865.6 NaN NaN NaN NaN NaN
10-Sep-2017 4000 1066 NaN NaN NaN NaN NaN
03-Oct-2017 3000 799.53 NaN NaN NaN NaN NaN
29-Oct-2017 3000 799.53 NaN NaN NaN NaN NaN
18-Dec-2017 4000 1066 NaN NaN NaN NaN NaN
Udate2017 = year(data{:,1}) == 2017;
tdate2017 = data(Udate2017,:)
tdate2017 =
Date SAR USDollar TotalOf2015 TotalOf2016 TotalOf2017 TotalOf2018 TotalOfAllYears
___________ ____ ________ ___________ ___________ ___________ ___________ _______________
23-Jan-2017 5000 1332.5 NaN NaN NaN NaN NaN
12-Feb-2017 2000 533.02 NaN NaN NaN NaN NaN
28-Feb-2017 3500 932.78 NaN NaN NaN NaN NaN
30-Mar-2017 4500 1199.3 NaN NaN NaN NaN NaN
30-Apr-2017 5000 1332.5 NaN NaN NaN NaN NaN
29-May-2017 5000 1332.5 NaN NaN NaN NaN NaN
27-Jun-2017 4500 1199.3 NaN NaN NaN NaN NaN
30-Jul-2017 6000 1599.1 NaN NaN NaN NaN NaN
29-Aug-2017 7000 1865.6 NaN NaN NaN NaN NaN
10-Sep-2017 4000 1066 NaN NaN NaN NaN NaN
03-Oct-2017 3000 799.53 NaN NaN NaN NaN NaN
29-Oct-2017 3000 799.53 NaN NaN NaN NaN NaN
18-Dec-2017 4000 1066 NaN NaN NaN NaN NaN
Udate2018 = year(data{:,1}) == 2018;
tdate2018 = data(Udate2018,:)
tdate2018 =
Date SAR USDollar TotalOf2015 TotalOf2016 TotalOf2017 TotalOf2018 TotalOfAllYears
___________ ____ ________ ___________ ___________ ___________ ___________ _______________
03-Jan-2018 5000 1332.5 NaN NaN NaN NaN NaN
19-Feb-2018 4000 1066 NaN NaN NaN NaN NaN
13-Mar-2018 3000 799.53 NaN NaN NaN NaN NaN
18-Apr-2018 5000 1332.5 NaN NaN NaN NaN NaN
08-May-2018 5000 1332.5 NaN NaN NaN NaN NaN
21-May-2018 3000 799.53 NaN NaN NaN NaN NaN
10-Jul-2018 6000 1599.1 NaN NaN NaN NaN NaN
Udate2018 = year(data{:,1}) == 2018;
tdate2018 = data(Udate2018,:)
tdate2018 =
Date SAR USDollar TotalOf2015 TotalOf2016 TotalOf2017 TotalOf2018 TotalOfAllYears
___________ ____ ________ ___________ ___________ ___________ ___________ _______________
03-Jan-2018 5000 1332.5 NaN NaN NaN NaN NaN
19-Feb-2018 4000 1066 NaN NaN NaN NaN NaN
13-Mar-2018 3000 799.53 NaN NaN NaN NaN NaN
18-Apr-2018 5000 1332.5 NaN NaN NaN NaN NaN
08-May-2018 5000 1332.5 NaN NaN NaN NaN NaN
21-May-2018 3000 799.53 NaN NaN NaN NaN NaN
10-Jul-2018 6000 1599.1 NaN NaN NaN NaN NaN
if strcmp(cell2mat(data(i,4)),year)
end
Error using cell2mat
Subscripting into a table using one subscript (as in t(i)) is not supported. Specify a row subscript and a variable subscript, as in t(rows,vars). To select variables, use t(:,i) or for one variable t.(i). To select rows, use
t(i,:).
fprintf(' The total spent money in %d is %s\n',data,year(data{:,1}))
fprintf(' The total of spent money of all years is %0.1f',data,total(i))
plot(tdate2015{:,1},tdate2015{:,3},'g-','Linewidth',1.8)
title('Monthly Stipend 2015')
plot(tdate2016{:,1},tdate2016{:,3},'b-','Linewidth',1.8)
title('Monthly Stipend 2016')
plot(tdate2017{:,1},tdate2017{:,3},'k-','Linewidth',1.8)
title('Monthly Stipend 2017')
plot(tdate2018{:,1},tdate2018{:,3},'r-','Linewidth',1.8)
title('Monthly Stipend 2018')