登录论坛

查看完整版本 : Choose one array for each group of arrays?


poster
2019-11-25, 21:20
<p>I have <code>N</code> groups of arrays. Each group contains 3 arrays for example.
Now I would like to take only one array at random from each of these groups and take a product with <code>B</code> array.</p>

<p>For example:</p>

<pre><code>Group_1=[A_1 ,A_2, A_3];
...
Group_N=[A_m ,A_k, A_l];
</code></pre>

<p>Now I am choosing one array in each group and taking a product with <code>B</code></p>

<pre><code>C_1=A_2*B; % Matlab has choosen random A_2 in group_1

...

C_N=A_k*B; % Matlab has choosen random A_kin group_N

</code></pre>

<p>How to implement such computation? </p>

<p>I have tried <code>A(randi(numel(A)))</code>, but it doesn't work.</p>



More answer... (https://stackoverflow.com/questions/59032570/choose-one-array-for-each-group-of-arrays)