MATLAB: I would like to understand this statement in matlab: x=y(z) where y and z are both vectors

i would like to understand this statement in matlab: x=y(z) where y and z are both vectors

I would like to understand this statement in matlab: x=y(z) where y and z are both vectors

Best Answer

Hi,
x gets the value of y which is found at index z in y.
y=5:9
z=3
x=y(z)
results in x = 7, since 7 is found at index number 3 in y.
See the documentation for further information.
Best regards
Stephan