# Create a program code for a function file “quantity” which takes as input one vector “v” and a number “t”, and returns the quantity of numbers in the vector “v” which is equal to the number “t”

1. A) Create a program code for a function file “quantity” which takes as input one vector “v” and a number “t”, and returns the quantity of numbers in the vector “v” which is equal to the number “t” (Example: quantity t ([2 1 2 3 2], 2) = 3). Your code must begin with

function x = quantity (v, t)

1. B) b) Create program code for a function file “quantity A” which generalizes the function from 3a), takes as input a table (matrix) “A” and a number “t”, and returns the quantity of numbers in the table “A” which is equal to the number ” t ”. The code should start with

function x = quantityA (A, t)

HINT: You can determine the number of rows (n) and columns (m) in the table “A” with the code line [n, m] = size (A) ;.

Create a program code for a function file “quantity” which takes as input one vector “v” and a number “t”, and returns the quantity of numbers in the vector “v” which is equal to the number “t”
Scroll to top