Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function in matlab for these parameters (char) A string representing 7 days of the week (eg. 'N M T W R F S')

image text in transcribedWrite a function in matlab for these parameters

(char) A string representing 7 days of the week (eg. 'N M T W R F S') (double) A vector representing 7 dates of the week (eg. [4 5 6 8 79 10]) (double) A positive or negative number of days (char) A string representing 7 days of the new week (double) A vector representing 7 dates of the new week circshift() It's fairly simple to determine what the date was or will be in a certain number of days. However, it's a little more challenging to figure out what day of the week that new date corresponds to. Thankfully we have MATLAB to depend on for this task. Write a function that takes in an input string that represents the current days of the week ('N' = Sunday, 'R' = Thursday) and a vector that represents the current dates of that week. The function will also take in a third input that represents the number of days into the future or past we are shifting the weekly calendar. Using this information, your function should be able to determine the new vector of dates for the new week, in addition to the correct order of days that correspond to these new dates. You should also be able to account for whether the dates go into a new month. Given: days = 'M T W R F S N' dates = [24 25 26 27 28 29 30] shift = 5 And that the function is called: >> [newDays, newDantes] = weeklyCalendar (days, dates, shift) Then the outputs would be: newDays = 'S N M T W R F' newDates = [29 30 1 2 3 4 5]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions