MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   Choose one array for each group of arrays? (https://www.labfans.com/bbs/showthread.php?t=22134)

poster 2019-11-25 21:20

Choose one array for each group of arrays?
 
<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>



[url=https://stackoverflow.com/questions/59032570/choose-one-array-for-each-group-of-arrays]More answer...[/url]


所有时间均为北京时间。现在的时间是 19:40

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.