Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use math lab please Extra Cred Function Name: puzzleBox Inputs: 1 (char) A jumbied character array 2 (doubile) The row shit vector 3 (double) The

image text in transcribedUse math lab please
Extra Cred Function Name: puzzleBox Inputs: 1 (char) A jumbied character array 2 (doubile) The row shit vector 3 (double) The column shift vector Outputs: (char) The solved character amay Banned Functions: circshft() Background You planned to get your special pat a box of chocciales for Valentine's day but forgot create a special unti the last moment Since the stores are soild out of chocolates, you decite to puzzle bex to give as a present And you can use MATLAB 1o heip you do at Write a function caled puzzleBox that will take in a umbled character aray and two vectors (representing a row shit and a column shitl) and produce a satisfying ast elements in the row and column shift vectors r all other mumbers in the vector represent which row/columns to shift ASCll image. The represent the number of shifts to make, while Por example, if the row shift vector was [, 5, 12, ]. this would indicate thet you chits should wrap around to column 1 t they go past the ight edge of the amay). Positive row shifts move shits move elements down. Negative shifts move in he roas side first and then the should shit every element in row 3, 5 and 12 to the right by 7 oolumes elerments to the right and positive column opposite direction. Your code should be formated such that Example: Given the tollowing inputs: jumbledcharrr - rowshift , , 2 def... ehs colShift - 12-51 You should fest shit rows 1 and 3 by 2 elements to the right (arapping elements around the end of each column). This proceture wil produce he array afterko-shift L'bcai def": HiE Then you should shift column 2 by 5 elements up (wrapping elements around the end of each row) Becase hearray is a 3.3, shiftng by 5nth, upward drection is equivalent to shifting by 1 in the downward direction ('cough" modt) "cough'). Therefore, the final character rray produced by these inputs is finalCharar. def':... heg'1 Notes: . The shift value can be any ieteger . The index elements will always consist of valid rowlcolumn indices Hints: . You wil find the nod ( ) functon very useful. . Character arrays are just normal arrays in disguise

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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