Tom M.

asked • 11/16/14

Matlab, re-writing programming

Hi, I have been given this programming for calculating time. However I would like to write this out in a far more straight forward, simpler form. Is it possible for anyone to show me how I can do this? Thanks! 
 
Time (1:744,1) = zeros(744,1) + 2011; % Year
Time (1:744,2) = zeros(744,1) + 08; % Month
for k1 = 1:31
Time(1+(24*(k1-1)):24+(24*(k1-1)),3) = k1; % Day
Time(1+(24*(k1-1)):24+(24*(k1-1)),4) = [0:1:23]; % Hour
end

Time (1:744,5) = zeros(744,1); % Minute
Time (1:744,6) = zeros(744,1); % Second

%N = datenum(Y,MO,D,H,MI,S) and N = datenum([Y,MO,D,H,MI,S]) return the
% serial date numbers for corresponding elements of the Y,MO,D,H,MI,S
% (year,month,day,hour,minute,second) arrays.
N = datenum(Time(:,1),Time(:,2),Time(:,3),Time(:,4),Time(:,5),Time(:,6));

1 Expert Answer

By:

Dal J. answered • 11/16/14

Tutor
4.9 (64)

Expert Instructor in Complex Subjects and Public Speaking

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.