How modifying the input of a function : from (unique) vector to matrix ?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How modifying the input of a function : from (unique) vector to matrix ?

Jaouad Daoudi
Hi,

I have a script that compute an index. The input of the function is:

(i) the vector of weight of each player (l) and;
(ii) the quota (limit).

It works well for a single vector. However, I need help to modify the code in order to compute the index for several cases (several vectors) (the quota "limit" stay always invariable that we specify in the beginning (ex. 50 or 40 or 20...)). In other words, I want that the input will be:

(i) the Matrix summarizing several vectors of weight of each player (l) and;
(ii) the quota (limit).

Example:
Instead of doing the computation on l1 = [20 30 15 25 10] then on l2 = [49 2 49 0 0], then l3 ...., I would like that my input in the function will be a matrix with several rows like for example :

(i) L = [20 30 25 25; 49 2 49 0 0; 20 30 15 25 10; 49 2 49 0 0].
(ii) limit = 50

Thank you in advance for your help and for you support.
(Please, see the attached script)



shapley.txt (1K) Download Attachment