split data in a special manner
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
I have a matrix named A (450*1102) 1- I want to take from each three objects (e.g. 3*1102), the first object (1*1102) to another set called B My new set will be B=150*1102
2- I split the objects from set B randomly myself for example B1= 1, 5, 8, 15 , ... B2= 2,3,4,6,7,9,10,11,12,13,14,...
Then I want to generate two sets called BF and BS BF is taking the B1 according to the Set A BS is taking the objects according to the set B
If you look above, the set B is generated based on set A (each three objects one of them to the set B) So when I want to generate the set BF, I want to use the B1 .Object 1 selected in B1 corresponds to object 1,2,3 of set A sample 2 in BS correspond to 2,3,4, etc
Respuestas (2)
Andrei Bobrov
el 30 de Mayo de 2014
a=magic(18);
bb=[1 3 6];
k = 3;
i0 = zeros(size(a,1),1);
i0(1:k:end) = 1;
out = a(ismember(cumsum(i0),bb),:);
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!