Question: please help with these MATLAB codes Validate a date values 1 solution submitted (max: 3) | View my solutions Write a function called valid_date that

please help with these MATLAB codes

please help with these MATLAB codes Validate a date values 1 solution

submitted (max: 3) | View my solutions Write a function called valid_date

Validate a date values 1 solution submitted (max: 3) | View my solutions Write a function called valid_date that takes three positive integer scalar inputs year, month day. If these three represent a valid date, return a logical true, otherwise false. The name of the output argument is valid. If any of the inputs is not a positive integer scalar, return false as well. Note that every year that is exactly divisible by 4 is a leap year, except for years that are exactly divisible by 100. However, years that are exactly divisible by 400 are also leap years. For example the year 1900 was not leap year, but the year 2000 was. Note that your solution must not contain any of the date related built-in MATLAB functions Function Reset I MATLAB Documentation function [valid] = valid_date(year, month, date) 5 %check for leap year if year is leap year 6 %'is_leap_year' is set 'l' else '' 7 8 if( mod (year, 4) == 0 && mod(year, 100)=0) 9 is_leap_year=1; 10 else 11 is_leap_year=0; 12 end 13 %------check for months with 31 days 14 if any (month-=[1 3 5 7 8 10 12]) 15 valid = (date>=0 && date=0 && date=0 && date-&& date

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!