I start with A a N by 3 matrix generated from data, which I use to create another N by 3 matrix B , with which using a cross product I create the last N by 3 Matrix C.
Each of these matrixes rows ( or columns with permutation) are the column of my last matrix Result.
I want to take in a vectorised operation, the first row ( or column in permutated) of each of these matrixes to create my first 3 by 3 matrix, do the same for the secon, third and so on until the nth element.
which I will then transform in a 3 by 3 by N matrix with reshape.
However I'm having a lot of trouble create the Result matrix because anything that I tried ended up giving me the concatenation of all A by all B by all, and I do not know of the existence of a column operator that restarts the count if it arrives to the end( otherwise I could re- arrange the matrix using the number [A(1:3N:N)),B(N+1:3N,N)C(2N+1:3N:N)].
So in matrix representation I'm looking for this:
A=[1 ,10, 19;2, 11, 20 ;3, 12, 21]
A =
1 10 19
2 11 20
3 12 21
>> B=[4 13, 22;5,14, 23; 6, 15 ,24]
B =
4 13 22
5 14 23
6 15 24
>> C=[7 16, 25; 8 17,26; 9 18, 27]
C =
7 16 25
8 17 26
9 18 27
>> D=[1 ,4,7,10,13,16,19,22,25;2,5,8,11,14,17,20,23,26;3,6,9,12,15,18,21,24,27]
D =
1 4 7 10 13 16 19 22 25
2 5 8 11 14 17 20 23 26
3 6 9 12 15 18 21 24 27
Result=reshape(D,3,3,[])
Result(:,:,1) =
1 4 7
2 5 8
3 6 9
Result(:,:,2) =
10 13 16
11 14 17
12 15 18
Result(:,:,3) =
19 22 25
20 23 26
21 24 27