I am trying to do an operation like the following for every pixels in an image:
A is x*y*4 matrix, w is simply an 1x9 vector.
I have a matrix L which is 200x200x4x9.
The first two dimensions of L are (x,y) location of pixels. Each location has 4 different sub-pixel (the third dimension). Every sub-pixel has a vector m, which is the last dimension is the m in my equation.
I plan to get the result for the 1st sub-pixel for the whole image, that's what I tried:
A (:,:,1) = w * L (:, :, 1, :) ====> Inputs must be 2-D, or at least one input must be scalar.
A (:,:,1) = w * L (:, :, 1, :)' ====> Transpose on ND array is not defined.
A (:,:,1) = w * reshape (L (:, :, 1, :), 1, 9)' ===> To RESHAPE the number of elements must not change.
If I just print L (1,1,1,:) I get values of individual elements (does not look like a vector):
ans(:,:,1,1) = 0.8980
ans(:,:,1,2) = 0.8065
ans(:,:,1,3) = 0.8471
ans(:,:,1,4) = 0.7607
ans(:,:,1,5) = 0.7175
ans(:,:,1,6) = 0.9020
ans(:,:,1,7) = 0.8100
ans(:,:,1,8) = 0.7640
ans(:,:,1,9) = 0.8135
EDIT: For reference,
Size(A) = [200 200 4]
Size(L) = [200 200 4 9]
Size(w) = [1 9]
EDIT: That's how I do it using loops
squeeze(L(1,1,1,:))
. – H.Muster