Question: Matlab problem. ALL conditional functions are BANNED. Function Name: timeUnscrambler Inputs: 1. (double) MxN array representing your scrambled time card Outputs: 1. (double) Mx(N+1) array

 Matlab problem. ALL conditional functions are BANNED. Function Name: timeUnscrambler Inputs:

1. (double) MxN array representing your scrambled time card Outputs: 1. (double)

Matlab problem. ALL conditional functions are BANNED.

Function Name: timeUnscrambler Inputs: 1. (double) MxN array representing your scrambled time card Outputs: 1. (double) Mx(N+1) array representing your fixed time card Topics: (array masking), (sorting arrays), (linear indexing) Background: You've just been hired as a TA for Georgia Tech's newest computer science class, CS1731. In hopes that the CS department will give you a raise, you decide to take on some extra hours by working the overnight shift at the help desk. Each night, you log the hours you've worked on a timecard, and at the end of the week you turn it in to your boss in hopes of that prized promotion. One evening, however, you fall asleep for 5 minutes on the job and when you wake up, your pesky co-TA's have messed with your time cards to ruin your chances of impressing your boss! Desperate, you turn to MATLAB to help you unscramble the mess. Function Description: You are given an array of doubles representing your scrambled time card. Apply the following operations to unscramble your card: 1. Replace all negative numbers in your array with their positive equivalent (i.e. -55) 2. Flip the order of the elements in your array's major diagonal, for example: 2 4 2 3 4. 3 7 [0 5 8 7 8 [ 1 5 9 3 0 1 2 9 0 2 1 ] 4 5 ] 3 4 5 3. Sort the rows of your array in ascending order based on the first column (i.e. the numbers should get larger as you go down the rows in the first column). 4. The first column of your sorted array will represent the amount of time you have worked, in minutes. Replace this column with two separate columns in the final output, where the first column is the number of hours you have worked, and the second is the number of additional minutes. For example: [ 100 234 52 300 [ 1 40 3 54 0 52 5 0 ] ] Example: scrambled = -23 3 -40 [ -11 8 0 382 -49 -22 123 -80 563 -2 63] 4. 4 unscrambled = timeUnscrambler (scrambled) unscrambled 8 22 [ 0 1 123 23 49 0 40 3 3 1 20 382 2 9 23 4 4 11 ] Hints: To linearly index out the values of the major diagonal, start by finding the starting index, step size, and stopping index for the diagonal first. Try writing out 5x3, 3x3, and 3x5 arrays and ask yourself the following questions: How do the indices for the major diagonal behave? What patterns do you observe (either in step sizes or stopping index values) in relation to the array's dimensions? How can you flip or reverse the order of a vector using linear indexing? 0 O . Function Name: timeUnscrambler Inputs: 1. (double) MxN array representing your scrambled time card Outputs: 1. (double) Mx(N+1) array representing your fixed time card Topics: (array masking), (sorting arrays), (linear indexing) Background: You've just been hired as a TA for Georgia Tech's newest computer science class, CS1731. In hopes that the CS department will give you a raise, you decide to take on some extra hours by working the overnight shift at the help desk. Each night, you log the hours you've worked on a timecard, and at the end of the week you turn it in to your boss in hopes of that prized promotion. One evening, however, you fall asleep for 5 minutes on the job and when you wake up, your pesky co-TA's have messed with your time cards to ruin your chances of impressing your boss! Desperate, you turn to MATLAB to help you unscramble the mess. Function Description: You are given an array of doubles representing your scrambled time card. Apply the following operations to unscramble your card: 1. Replace all negative numbers in your array with their positive equivalent (i.e. -55) 2. Flip the order of the elements in your array's major diagonal, for example: 2 4 2 3 4. 3 7 [0 5 8 7 8 [ 1 5 9 3 0 1 2 9 0 2 1 ] 4 5 ] 3 4 5 3. Sort the rows of your array in ascending order based on the first column (i.e. the numbers should get larger as you go down the rows in the first column). 4. The first column of your sorted array will represent the amount of time you have worked, in minutes. Replace this column with two separate columns in the final output, where the first column is the number of hours you have worked, and the second is the number of additional minutes. For example: [ 100 234 52 300 [ 1 40 3 54 0 52 5 0 ] ] Example: scrambled = -23 3 -40 [ -11 8 0 382 -49 -22 123 -80 563 -2 63] 4. 4 unscrambled = timeUnscrambler (scrambled) unscrambled 8 22 [ 0 1 123 23 49 0 40 3 3 1 20 382 2 9 23 4 4 11 ] Hints: To linearly index out the values of the major diagonal, start by finding the starting index, step size, and stopping index for the diagonal first. Try writing out 5x3, 3x3, and 3x5 arrays and ask yourself the following questions: How do the indices for the major diagonal behave? What patterns do you observe (either in step sizes or stopping index values) in relation to the array's dimensions? How can you flip or reverse the order of a vector using linear indexing? 0 O

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!