I have two column vectors A=(3, 4, 6, 9, 12, 34, 56, 99, 105, 190)' and B=(4, 12, 34, 56)' both are sorted in increasing order. And a bbig matrix D of size mxn, where m is no. of rows in A.
Purpose: is to divide the matrix D into two segments ,
a) matrix E which has 4 rows (=number of rows in B) which are the 2nd, 5th, 6th.. rows of matrix D
b) matrix F which has 6 rows (= numbers of rows in A minus number of rows in B) which are 1st, 3rd, 4th, 6th, ...etc rows of D,
So basically the row numbers given bby A has to divided into B and notB.
Here's what I am doing:
I need to find out the placement of each element of B in A. So I am using :
C(i,1) = find(B(i,1)==A)
Question 1: Is there a way to vectorise this process and avoid the LOOP
After that I want to locate the row indexed by B and not B in a mXn matrix D, so I am using
E(rowEindex,:) = D(j,:)
rowEindex = rowEindex+1
E(rowFindex,:) = D(j,:)
rowFindex = rowFindex+1
Question 2: Is there a way to speed up this process, again without using the LOOP
many thanks for your response.