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: truncation problem
Replies: 5   Last Post: Jan 12, 2014 1:48 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Nasser Abbasi

Posts: 5,645
Registered: 2/7/05
Re: truncation problem
Posted: Jan 9, 2014 11:36 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 1/9/2014 8:27 PM, Mohammad Sayeed wrote:
> Hello I need to truncate my data base like following:
> Say, I have a vector like this:
> 1
> 2
> 3
> 4
> 1
> 2
> 3
> 4
> 1
> 2
> 3
> 4
> from 1 to 4 the numbers are repeating. I need to remove 1st and 4th row from
>each repeated 4 rows. so that the data will look like
> 2
> 3
> 2
> 3
> 2
> 3
> I tried but failed to do that with MATLAB as I am a new MATLAB user.
>If any one can help me it will be much appreciated.
>


If the data is just as gives, you can simply repmat the section of
interest:

----------------------
N=length(A);
repmat(A(2:3),N/4,1)

2
3
2
3
2
3
---------------------

if you have a more general case, then you'd need a more general
solution.

--Nasser




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.