Homework 07 Solution

$30.00 $24.00

Function Name: ​countNum Inputs: (​double)​ An array of any size MxN (​​double) A particular number to search for Outputs: 1.​ (​double) A count of how many times the given number occurs in the array Function Description: Write a function in MATLAB named ​countNum()​ ​that will take in an input array of size MxN and compare…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Categorys:
Tags:

Description

5/5 – (2 votes)

Function Name: countNum

Inputs:

  1. (double) An array of any size MxN

  1. (double) A particular number to search for

Outputs:

1. (double) A count of how many times the given number occurs in the array

Function Description:

Write a function in MATLAB named countNum()​ ​that will take in an input array of size MxN and compare each index within the array to find if it is equal to the second input. The output value should be equal to the number of indices in the array that are equal to the second input.

Notes:

  • The first input will always be a rectangular array of numbers. The second input will always be a single number.

  • You MUST use iteration on this problem.

*You have learned how to code something like this using logical masking, however, this should be a simple function to learn the process of iteration.

Hints:

  • Using a counter variable could be useful.

Homework 07 Solution
$30.00 $24.00