LABT - date = num2str(mgs_vec(i,1)); year =...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% Load in the Motor Gasoline supply data mgs_vec = load('MGSupply.txt'); % Set up the conversion from column vector to data table n = length(mgs_vec); % counts number of data points date = num2str(mgs_vec(1,1)); % read the date and year_old = str2num(date(1:4))-1; % extract the year j = 0; % set a year counter % Create a blank location to store the data table mgs = zeros(floor(n/13),13); % Fill the table for i = 1:n
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: date = num2str(mgs_vec(i,1)); year = str2num(date(1:4)); mon = str2num(date(5:6)); if year ~= year_old % check if the year has changed j = j+1; % update the year counter year_old = year; % store the new year value mgs(j,1) = year; % write the year to the data table end if mon < 13 % month 13 is the yearly average; skip it mgs(j,mon+1) = mgs_vec(i,2); % store the data in the table end end...
View Full Document

Ask a homework question - tutors are online