[Matlab] How to shift the element in vector?

Status
Not open for further replies.

davyzhu

Advanced Member level 1
Joined
May 23, 2004
Messages
494
Helped
5
Reputation
10
Reaction score
2
Trophy points
1,298
Location
oriental
Activity points
4,436
matlab shift vector

Hi all,
How to shift the element in vector?
For example, vec=[1 2 3 4 5 6 7 8 9 10];
vec2=right_shift(vec,3);
then shift the vec by 3 time
vec2=[8 9 10 1 2 3 4 5 6 7].

Any easy approach will be appreciated!
Best regards,
Davy
 

shift vector matlab

vec = [1 2 3 4 5 6 7 8 9 10];
vec2 = circshift(vec, [1 3]);
 

Hi Davy,

I'm not sure, your problem are the same of me.
I think you want to rotate the element, are not?
My job have a box on the conveyor but it put in the incorrect direction.
i want to use MATLAB to find the shifting degree of a box from the reference point
and i will sent this value to the servo drive to control the robot arm to rotate a box.
I'm not sure my job is samy you. if you have more information please copy to me.

Very thank you
Naja
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…