I have 4 vectors A, B, C, D with
A=1:6; B=1:5; C=1:10; D=1:4; % in real case, the max values i.e 6, 5, 10 and 4, are not always equal to those values but always integers
ADBC = allcomb(A,D,B,C); % each row corresponds to an experimental condition involving one of each parameter A, B, C, D
Now, I want to reorganize ADBC elements (row) in order to build a new matrix ABCD = allcomb(A,B,C,D);
As an example, I have ADBC = [2 2 3 1], which means A=2, B=3, C=1 and D=2;
The question is what is the row of ABCD corresponding to the same condition (A=2, B=3, C=1, D=2) if it was organized as ABCD, i.e [2 3 1 2] ?
Here is the answer :
A=1:6; B=1:5; C=1:10; D=1:4;
ABCD = allcomb(A,B,C,D);
ADBC = allcomb(A,D,B,C);
i = 0; crush = 1;
while crush ~= 4
check = find(ADBC(i,:) == [2 2 3 1]);
crush = length(check);
i = 0; crush2 = 1;
while crush2 ~= 4
check2 = find(ABCD(i,:) == [2 3 1 2]);
crush2 = length(check2);
So I would like to rebuilt the transfer function between the known ADBC and the rebuilt ABCD.
So, I guess I should write a loop (from 1 to 6*5*10*4=1200) to scan each ADBC element (ex1), get the old position (271 in the example), then sort the element with respect to "ABCD" order, then get the new position in case of ABCD vector (282 in the example).
So ABCD(282) = ADBC(271).
Can anyone simplify this approach ?
How to generalize to any ACBD, ADBC, ABDC, ... (24 cases) to rebuild ABCD in any case ? ABCD is my goal.