# Return specified rows of a vector

1 Ansicht (letzte 30 Tage)
Nick am 2 Aug. 2013
Hello,
I've tried searching for a solution to my problem, but I'm afraid I couldn't find anything. I'm hoping someone can either point me in the right direction, or help give me a hint here :)
Say I have a vector of data A
A = [4;8;2;3;8;6];
And I have a vector of specified rows i
i = [1;3;5;6];
How do I return a vector B, which is the specified rows of A as specified by i, like below?
B = [4;2;8;6]
I've been trying various logical operations, but haven't been able to figure it out yet.
Thanks for the help!
##### 0 Kommentare-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Kye Taylor am 2 Aug. 2013
Bearbeitet: Kye Taylor am 2 Aug. 2013
Try
A = [4;8;2;3;8;6];
i = [1;3;5;6];
B = A(i)
##### 1 KommentarKeine anzeigenKeine ausblenden
Azzi Abdelmalek am 2 Aug. 2013
Nick commented
I knew it would be something stupidly simple that I failed to see :)
Thanks so much!

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Uniform Distribution (Continuous) finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by