how to extract elements that are not succesive

how can I extract elements that are not succesive?
For example, how can I extract 1st, 3nd and 6th elements from 7x1 matrix density?
It would be really helpful if you can help me solve the problem..

Answers (2)

Y([1, 3, 6])
or
Y(round(5*(1:3)/2-5/3))
Here's help: Invest 2 hours of your time here:
You will learn things like that plus more.

2 Comments

The question above was actually the question that I had during studying that cource lol🤣 thanks for your recomendation anyway
OK, then they must have told you how to do it in advance, though perhaps with different numbers. In my experience you're taught/told things and then tested afterwards, with situations where the facts/numbers are slightly altered, on things that you've been taught. I don't think they'd ask you something completely out of the blue that you have not yet been taught. Anyway, Walter's answer is correct and I hope you enjoy using MATLAB like the rest of us. 😁

Sign in to comment.

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Products

Asked:

on 25 Aug 2023

Commented:

on 30 Aug 2023

Community Treasure Hunt

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

Start Hunting!