Question: How to write a matlab function that can extract uppercase, lowercase, numbers and NaN/Inf from a cell array? Write a function with the following header:
Write a function with the following header: function [upper case, lower case, numbers, speciall-my cell extractor(array) where array is a 1 n cell array. Each element of array is either A non-empty row vector of class double. A non-empty row vector of class char (i.e. a non-empty character string). A non-empty cell array that follows the same format as array. upper case is a non-empty row vector of class char that contains all the upper case characters found in the elements of the input parameter array, in the order in which they appear in array. lower case is a non-empty row vector of class char that contains all the lower case characters found in the elements of the input parameter array, in the order in which they appear in array. numbers is a non-empty row vector of class double that contains all the elements of class double (except for NaN nf, and Inf found in the elements of the input parameter array, in the order in which they appear in array. special is a non-empty row vector of class double that contains all the elements of class double among NaN, nf, and Inf, that are found in the elements of the input parameter array, in the order in which they appear in array. Treat lower case letters from a to z as lower case characters, and any other character as upper case. You can assume that you will nd in array: At least one lower case character; and At least one upper case character; and At least one element of class double that is not NaN, -Inf, or Inf and At least one element of class double that is one of NaN, -Inf, and Inf In other words, none of your function's outputs should be an empty array. Hints You may want to consider using recursion for this question If the variable c is a 1-1 array of class char i.e. a character string that contains only one character, you can check whether this character qual es as upper case for this question by using the logical expression c upper (c). This logical expression will evaluate to true (logical 1) if the character should be considered upper case, and false (logical o) otherwise. Test cases: lu, n, sl my cell extractor( (4. NaN, 6.0, a', -1, 'B')) an 460 -1 NaN Write a function with the following header: function [upper case, lower case, numbers, speciall-my cell extractor(array) where array is a 1 n cell array. Each element of array is either A non-empty row vector of class double. A non-empty row vector of class char (i.e. a non-empty character string). A non-empty cell array that follows the same format as array. upper case is a non-empty row vector of class char that contains all the upper case characters found in the elements of the input parameter array, in the order in which they appear in array. lower case is a non-empty row vector of class char that contains all the lower case characters found in the elements of the input parameter array, in the order in which they appear in array. numbers is a non-empty row vector of class double that contains all the elements of class double (except for NaN nf, and Inf found in the elements of the input parameter array, in the order in which they appear in array. special is a non-empty row vector of class double that contains all the elements of class double among NaN, nf, and Inf, that are found in the elements of the input parameter array, in the order in which they appear in array. Treat lower case letters from a to z as lower case characters, and any other character as upper case. You can assume that you will nd in array: At least one lower case character; and At least one upper case character; and At least one element of class double that is not NaN, -Inf, or Inf and At least one element of class double that is one of NaN, -Inf, and Inf In other words, none of your function's outputs should be an empty array. Hints You may want to consider using recursion for this question If the variable c is a 1-1 array of class char i.e. a character string that contains only one character, you can check whether this character qual es as upper case for this question by using the logical expression c upper (c). This logical expression will evaluate to true (logical 1) if the character should be considered upper case, and false (logical o) otherwise. Test cases: lu, n, sl my cell extractor( (4. NaN, 6.0, a', -1, 'B')) an 460 -1 NaN
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
