Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

Topic: Insert array into middle of an array
Replies: 1   Last Post: Oct 17, 2013 9:50 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
David Quilligan

Posts: 10
Registered: 10/11/13
Insert array into middle of an 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

Hi,

I currently have a column vector of any length and I want to insert another column vector 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]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.