initial commit of Gregorian/IFC date conversion tools and unit tests
This commit is contained in:
30
isLeap.m
Normal file
30
isLeap.m
Normal file
@@ -0,0 +1,30 @@
|
||||
function flag = isLeap(Year)
|
||||
arguments (Input)
|
||||
Year (:, 1) uint16
|
||||
end
|
||||
arguments (Output)
|
||||
flag (:, 1) logical
|
||||
end
|
||||
|
||||
% flag = NaN(size(Year));
|
||||
|
||||
isDivisibleBy4 = ~mod(Year, 4);
|
||||
isNotDivisibleBy100 = logical(mod(Year, 100));
|
||||
isDivisibleBy400 = ~mod(Year, 400);
|
||||
|
||||
flag = isDivisibleBy4 & (isDivisibleBy400 | isNotDivisibleBy100);
|
||||
|
||||
% if ~mod(Year, 4)
|
||||
% if ~mod(Year, 100)
|
||||
% if ~mod(Year, 400)
|
||||
% flag = true;
|
||||
% else
|
||||
% flag = false;
|
||||
% end
|
||||
% else
|
||||
% flag = true;
|
||||
% end
|
||||
% else
|
||||
% flag = false;
|
||||
% end
|
||||
end
|
||||
Reference in New Issue
Block a user