The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Insert group of data into array
Replies: 0  

Advanced Search

Back to Topic List Back to Topic List  
David Quilligan

Posts: 10
Registered: 10/11/13
Insert group of data into array
Posted: Oct 17, 2013 8:49 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply


I currently have a column vector of any length and I want to insert another column vector of length 5 at various points of the original array. i.e. I want to add my new array to the start of the old array skip say 10 places add my new array again, skip 10 spaces again and add my new array again and so on till the end of the array. I can do this by using:

OffsetSign = [1:30]';
Extra = [0;0;0;0;0];
OffsetSign =[Extra;OffsetSign(1:10);Extra;OffsetSign(11:20);Extra;OffsetSign(21:30)];

However this is not suitable for longer arrays. Any tips on an easy way to do this for longer arrays?

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.