Question: Please answer using Matlab code. Failure to do so will result in reporting. Thank you. Write a function, phone_number, that accepts a character array representing

 Please answer using Matlab code. Failure to do so will result

Please answer using Matlab code. Failure to do so will result in reporting. Thank you.

Write a function, phone_number, that accepts a character array representing a phone number (for example, "614-555-1234' and returns an array of integers, e.g. [6, 1,4,5,5,5, 1, 2, 3, 4). The function should be able to handle different formats: digits only (6145551234'), with dashes (614-555-1234'), and with parentheses ("(614)555-1234'). Hints: The ASCII codes for '1' through '9 are is 49 - 57, respectively. Multiplying a character by 1 converts it to its ASCII code. (e.g. '1'*1 equals 49) Think about what you get if you take a character array containing digits, multply by 1, and subtract 48. Use logical indexing to ignore characters like "or' that fall outside this range. Function Code to call your function 1 phone_number('6145551234) 2 phone_number('614-555-1234') 3 phone_number('(614)555-1234')

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!