split data in a special manner
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
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
댓글 수: 0
답변 (2개)
댓글 수: 0
Andrei Bobrov
2014년 5월 30일
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),:);
댓글 수: 0
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!