User`s guide

Exporting Multiple Records from the MATLAB Workspace
6-23
curs = fetch(curs);
5
Use columnnames to view the column names in the fetched data set:
columnnames(curs)
ans =
'StockNumber', 'January', 'February', 'March', 'April',
'May', 'June', 'July', 'August', 'September', 'October',
'November', 'December'
6
View the data for January (column 2).
curs.Data(:,2)
ans =
1400
2400
1800
3000
4300
5000
1200
3000
3000
0
7
Assign the dimensions of the matrix containing the fetched data set to m and n.
[m,n] = size(curs.Data)
m =
10
n =
13
8
Use m and n to compute monthly totals. The variable tmp is the sales volume for all
products in a given month c. The variable monthly is the total sales volume of all
products for that month. For example, if c is 2, row 1 of monthly is the total of all
rows in column 2 of curs.Data, where column 2 is the sales volume for January.
for c = 2:n
tmp = curs.Data(:,c);
monthly(c-1,1) = sum(tmp(:));
end
View the result.
monthly