# position of a signal in a vector [closed]

I have 4 signals: $z,c,d$ and $r$. $r$ is defined by: $r=[c,z,d,z]$

I would like to find signal $d$. In Matlab I do this:

r2=r(size(c,2)+size(z,2)+(0:size(d,2)-1))


Do we have $r2=d$?

## closed as off-topic by Matt L., lennon310, MBaz, A_A, Stanley PawlukiewiczSep 15 '18 at 19:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "General programming questions are off-topic here, but can be asked on Stack Overflow." – Matt L., lennon310, MBaz, A_A, Stanley Pawlukiewicz
If this question can be reworded to fit the rules in the help center, please edit the question.

• Have you tried running your code and seeing if it works? – MBaz Sep 11 '18 at 18:39
• Don’t forget that Matlab has 1-based indexing – ThP Sep 12 '18 at 3:32

In case the four vectors are row vectors

r2=r(size(c,2)+size(z,2)+1:end-size(z,2))


In case the four vectors are column vectors

r2 = r(:,3)


PS: thanks @ThP

• Unless they are row vectors – ThP Sep 12 '18 at 3:28