Without loops:
>> [X,Y,Z] = ndgrid(1:3);
>> A = permute(cat(3,p(:,Z),ommega(:,Y),v(:,X)),[1,3,2]);
And checking with some examples:
>> [p(:,1),ommega(:,1),v(:,1)]
ans =
0 0 0
0 0 0
0 0 0
0.1 100 3
0.1 100 3
0.1 100 3
>> A(:,:,1)
ans =
0 0 0
0 0 0
0 0 0
0.1 100 3
0.1 100 3
0.1 100 3
>> [p(:,1),ommega(:,3),v(:,2)]
ans =
0 0 0
0 0 0
0 0 0
0.1 150 5
0.1 150 5
0.1 150 5
>> A(:,:,8)
ans =
0 0 0
0 0 0
0 0 0
0.1 150 5
0.1 150 5
0.1 150 5
>> [p(:,3),ommega(:,3),v(:,1)]
ans =
0 0 0
0 0 0
0 0 0
0.3 150 3
0.3 150 3
0.3 150 3
>> A(:,:,25)
ans =
0 0 0
0 0 0
0 0 0
0.3 150 3
0.3 150 3
0.3 150 3
Best Answer