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 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 <> wrote in message <kdh3ek$g4s$>...
> 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]

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