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

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

Accepted Answer

Stephan
Stephan on 17 Sep 2018
Edited: Stephan on 17 Sep 2018
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

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!