The built-in clock function returns a vector with six elements representing the year, month, day, hours, minutes and seconds. The first five elements are integers whereas the last is a double value, but calling it with fix will convert all to integers
belongs to book: MATLAB: A Practical Introduction to Programming and Problem Solving|Stormy Attaway|Fourth Edition| Chapter number:7| Question number:29.7
All Answers
total answers (1)
Ch7Ex30.m
% Compares years obtained from built-in functions
% date and clock to ensure they are the same
c = fix(clock);
d = date;
dyear = str2double(d(end-3:end));
if dyear == c(1)
disp('Years are the same!')
else
disp('Years are not the same.')
end
need an explanation for this answer? contact us directly to get an explanation for this answer