Reputation: 169
I have 3D
matrix (100*50*10)
and I want to plot one specific point in all slices. Let us say point (10*6*:)
. The plot should be in 2D
plane
Example (I have this coordinate for point that I want to plot)
x (10*6*1)
x (10*6*2)
x (10*6*3)
x (10*6*4)
x (10*6*5)
x (10*6*6)
x (10*6*7)
x (10*6*8)
x (10*6*9)
x (10*6*10)
I tried plot (x(10,6,:))
but I got error
Upvotes: 0
Views: 27
Reputation: 570
plot(squeeze(x(10,6,:)))
see: https://www.mathworks.com/help/matlab/ref/squeeze.html
x(10,6,:) is still a 3D matrix, and needs to be reduced to a 1D form before plotting it. This is where the squeeze function comes in.
Upvotes: 1