Question

Show transcribed image textConsider the problem the MATL AB system has in parsing the string: v = [1 2 3 4; 5, 6, 7; 8; 9 10] Your task is to use strtok to parse this line and construct the array it represents. You will write a function arrayphrase that consumes a string and returns two variables a string that is the variable name and an array. Tokenize the string first using '=' as the delimiter to isolate the variable name and the expression to be evaluated. Return the variable name to the user and save the rest of the line as the variable str1 for further processing. You may assume that there are no spaces outside the characters '[]'. Tokenize str1 with '[' and ']' to remove the concatenation operators and save the first token as str2. Tokenize str2 using ':' as the delimiter. This will produce 0 or more strings that represent the rows of the array. Save each in the variable rowSting. You may assume for now that the first row is the longest one. Using nested while loops, tokenize each rowstring with and ',' and '' as delimiters anti use ascanf(...) to extract the numerical value of each array entry Save it as rowEntry. Concatenate the rowEntry elements horizontally to produce each row of the array. If the row is too short, pad it with zeros Concatenate each row vertically to produce the resulting array and return that array to the caller. Test the function with cases like; empty = [ ] row = [1 2 3 4 ] diag = [0 0 0 1; 0 0 1; 0 1; 1]