random clustering of any number of rows and columns
1 view (last 30 days)
Show older comments
The following code executes
A=[0 0 41 0 0;
0 0 0 42 0];
non_0=sum(A);
non_0=repmat(non_0,2,1);
A_part=[1 2 3 4 5;
21 22 23 24 25];
new_A=A;
new_A(non_0 & A==0)=A_part(non_0 & A==0);
but I want to have for n number of rows and m number of columns and the rows of matrix of A and A_part should be clustered in the random manner as per the above code mentioned.In addition each cluster can have any number of rows.
1 Comment
Matt J
on 3 Jan 2018
Please indent your code, but not your text. Otherwise, your posts are hard to read.
Answers (0)
See Also
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!