Write a MATLAB function called countOfNumbers that takes an array (which contains numbers) as the input argument. This f
Posted: Tue May 24, 2022 8:09 am
Write a MATLAB function called countOfNumbers that takes an array (which contains numbers) as the input argument. This function will count the occurrence of all the digits in [0,9] in the input array. The count of each digit will be saved in an array called counts and this array will be returned by countOfNumbers function. The array length can be of any length. You must write the codes with functions and arrays. You cannot use any built-in MATLAB functions (except for zeros) for this question's solution. No other solution will be accepted. Example run outputs: >> a = [5 6 2 3 4 2 9 1 0 8 5 4 8]; >> countOfNumbers (a) ans = 1 1 2 1 2 2 1 0 2 1 >> >> a = [9 9 9]; >> countOfNumbers (a) ans 0 0 0 0 0 0 3 0 0 0