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 row in an array and delete last row
Replies: 7   Last Post: Jan 21, 2013 2:38 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Michael Doukas

Posts: 12
Registered: 12/26/12
Re: Insert row in an array and delete last row
Posted: Jan 20, 2013 11:20 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

dpb <none@non.net> wrote in message <kdh3ek$g4s$1@speranza.aioe.org>...
> That's likely going to be highly costly in terms of temporaries if
> you're doing this often to do that, specifically. Instead of moving L,
> just create N as
> N=[R; L(1:end-1,:)]; clear L
> In place you can try
> L=circshift(L,1); L(1,:)=R;
> or permutations of the above idea but I suspect they'll be slower than
> the previous although you can test it out...
> --

Thanks for the reply.
By R you symbolize the newly created row vector i suppose.

Moreover, in case i wanted to perform a check on whether this row vector already exists in the matrix, how should i implement it?
I have tried the ismember function but it does not fit my problem.

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

[Privacy Policy] [Terms of Use]

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