Can you help me ?

Write a function called year2016 that returns a row-vector of struct-s whose elements correspond to the days of a month in 2016 as specified by the input argument. If the input is not an integer between 1 and 12, the function returns the empty array. Each struct should contain three fields with these (exact) field names: “month”, “date”, and “day” (all lower case).

* The month field must contain a string with the name of the month (first letter capitalized).
* The date field must contain a scalar specifying the day of the month.
* The day field must contain the three-letter abbreviation of the day chosen from this list: ‘Mon’, ‘Tue’, ‘Wed’, ‘Thu’, ‘Fri’, ‘Sat’, ‘Sun’.

For example, here is a call of the function followed by a command that shows the seventh element of the struct array that is returned by the function:

>> m = year2016(2);
>> m(7)
ans =
month: ‘February’
date: 7
day: ‘Sun’

My code is here;

function x = year2016(m)
year2016.month = {‘January’;’February’;’March’;’April’;’May’;’June’;’July’;’August’;’September’;’October’;’November’;’December’};
TypeList = {‘Mon’,’Tue’,’Wed’,’Thu’,’Fri’,’Sat’,’Sun’};
for k = 1:numel(TypeList)
x = TypeList{k};
if month >0 && month<=12
return;
end
end
x = ‘NONE’;

I know that it has many error but I haven’t associate month , day and date. Please help me?Write a function called year2016 that returns a row-vector of struct-s whose elements correspond to the days of a month in 2016 as specified by the input argument. If the input is not an integer between 1 and 12, the function returns the empty array. Each struct should contain three fields with these (exact) field names: “month”, “date”, and “day” (all lower case).

* The month field must contain a string with the name of the month (first letter capitalized).
* The date field must contain a scalar specifying the day of the month.
* The day field must contain the three-letter abbreviation of the day chosen from this list: ‘Mon’, ‘Tue’, ‘Wed’, ‘Thu’, ‘Fri’, ‘Sat’, ‘Sun’.

For example, here is a call of the function followed by a command that shows the seventh element of the struct array that is returned by the function:

>> m = year2016(2);
>> m(7)
ans =
month: ‘February’
date: 7
day: ‘Sun’

My code is here;

function x = year2016(m)
year2016.month = {‘January’;’February’;’March’;’April’;’May’;’June’;’July’;’August’;’September’;’October’;’November’;’December’};
TypeList = {‘Mon’,’Tue’,’Wed’,’Thu’,’Fri’,’Sat’,’Sun’};
for k = 1:numel(TypeList)
x = TypeList{k};
if month >0 && month<=12
return;
end
end
x = ‘NONE’;

I know that it has many error but I haven’t associate month , day and date. Please help me? Write a function called year2016 that returns a row-vector of struct-s whose elements correspond to the days of a month in 2016 as specified by the input argument. If the input is not an integer between 1 and 12, the function returns the empty array. Each struct should contain three fields with these (exact) field names: “month”, “date”, and “day” (all lower case).

* The month field must contain a string with the name of the month (first letter capitalized).
* The date field must contain a scalar specifying the day of the month.
* The day field must contain the three-letter abbreviation of the day chosen from this list: ‘Mon’, ‘Tue’, ‘Wed’, ‘Thu’, ‘Fri’, ‘Sat’, ‘Sun’.

For example, here is a call of the function followed by a command that shows the seventh element of the struct array that is returned by the function:

>> m = year2016(2);
>> m(7)
ans =
month: ‘February’
date: 7
day: ‘Sun’

My code is here;

function x = year2016(m)
year2016.month = {‘January’;’February’;’March’;’April’;’May’;’June’;’July’;’August’;’September’;’October’;’November’;’December’};
TypeList = {‘Mon’,’Tue’,’Wed’,’Thu’,’Fri’,’Sat’,’Sun’};
for k = 1:numel(TypeList)
x = TypeList{k};
if month >0 && month<=12
return;
end
end
x = ‘NONE’;

I know that it has many error but I haven’t associate month , day and date. Please help me? struct, date, month, day of week MATLAB Answers — New Questions

​

Leave a Reply

Your email address will not be published. Required fields are marked *