I'm trying to do a 3+ dimensional version of what is shown here:
and the syntax eludes me. The example shown is clear enough for a 2D matrix, e.g.,:
>> A = [1 2; 3 4];
>> A(2,:)((A(2,:)>3)) = 0
error: () must be followed by . or close the index chain
>> A(2,A(2,:)>3) = 0
A =
1 2
3 0
but if I have a 3D array and I want to change the values of 'page' 2 based on the values of 'page' 4, can that be done in a similar one line assignment without using an intermediate variable? e.g.,
>> a = rand(2,3,4);
>> a(:,:,4)>0.5
ans =
1 1 1
1 1 0
>> a(:,:,2)(a(:,:,4)>0.5) = 0
error: () must be followed by . or close the index chain
>> a((a(:,:,4)<0.5),2) = 0
error: Invalid resizing operation or ambiguous assignment to an out-of-bounds array element
I feel like I'm missing something obvious.