I have a 3D matrix that consists of 3 matrices 500×500 elements. Now, I wanna take the third matrix and replace all its values that are, let’s say, bigger than 100 with 0. If I have a matrix a, my code would simply be:
a(a>100)=0
However, in my case I need to take the third matrix of my 3D matrix, which would be a(:,:,3).
If I now try to use the same code:
a(:,:,3)(a(:,:,3)>100)=0
I get the message “()-indexing must appear last in an index expression.”
Any idea on how I can express that?
What about
?