Note that there are some explanatory texts on larger screens.

plurals
  1. POMATLAB: concatenate 3 matrices into 1 new matrix with certain rule
    primarykey
    data
    text
    <p>3 matrices named as <code>A</code>, <code>B</code> and <code>C</code>. Each matrix have random <code>M x N</code> dimension. However, the <code>N</code> (column number) are equal. Randomly generate 1 row from each of the matrix and put into new matrix (named as <code>Fdata</code>) one by one, and then randomly generate 1 row from the each of the matrix again but can not be repeated from the previous randomly row generation and put into <code>Fdata</code> one by one again..do this accordingly...if one of the matrix is randomly generated once for each row without repeating, then the rest of the row can be randomly repeated again until the maximum rows from one of the matrix. </p> <p>If <code>A</code> is matrix of 5x5, <code>B</code> is a matrix of 2x5 and <code>C</code> is the matrix of 3x5, the <code>Fdata</code> will be a 15x5 matrix</p> <p>example:</p> <pre><code>A = 6 6 4 7 8 4 7 1 6 9 3 5 8 0 1 6 5 8 1 2 9 4 2 0 1 B = 4 7 2 8 5 5 6 0 1 2 C = 1 6 4 5 1 8 6 7 1 3 3 0 4 5 8 </code></pre> <p><strong>The final data i wish to get is</strong></p> <pre><code>Fdata = 4 7 1 6 9 %randomly from matrix A 5 6 0 1 2 %randomly from matrix B 1 6 4 5 1 %randomly from matrix c 6 6 4 7 8 %randomly from matrix A (but not repeated from previous randomly generated row) 4 7 2 8 5 %randomly from matrix B (but not repeated from previous randomly generated row) 3 0 4 5 8 %randomly from matrix C (but not repeated from previous randomly generated row) 3 5 8 0 1 %randomly from matrix A (but not repeated from previous randomly generated row) 4 7 2 8 5 %randomly from matrix B, repeated row because the row of matrix B is fully randomly generated 8 6 7 1 3 %randomly from matrix C (but not repeated from previous randomly generated row) 9 4 2 0 1 %randomly from matrix A (but not repeated from previous randomly generated row) .... </code></pre> <p>what code shall i write to get the <code>Fdata</code>?</p> <hr> <p>2nd question:</p> <p>let say <code>Fdata=xlsread('abc.xls,);</code> original <code>Fdata</code> has 5x2 matrix, after some codes, <code>Fdata</code> become 5x5 matrix..then <code>xlswrite('abc.xls',Fdata,'sheet2');</code> ..error occur...??? <code>Index exceeds matrix dimensions</code>...how can i solve this problem?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload