Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Remove Duplicate Values according to criterion

Subject: Remove Duplicate Values according to criterion

From: Shantharam

Date: 11 May, 2012 17:24:07

Message: 1 of 3

I have two matrices

ampmat = [68.75539589 70.70627741 72.0721373 80.32433467 8.875643035 4.472189209 1.966101838 1.418783172 0.919213277 0.812347605 0.715597877 0.656760549 0.688455694 0.859875845 1.045734641 1.827282907 3.753959435 5.614435942 3.646970094 3.708414655 3.345146553 3.363855225 2.433320998 1.738680617 1.199803437 0.82070146 0.782401601 0.96851817 1.181695482 1.519064218 1.344429667 0.720952257];

decisionmat = [1 2 3 4 5 6 7 8 9 9 11 11 13 14 14 15 16 17 17 18 20 20 20 22 23 24 26 27 27 28 28 27];

Here each element of decisionmat corresponds each element of ampmat respectively. i.e., 1 corresponds to 68.75, 2 corresponds to 70.70 and so on.

Now we can see that in decisionmat there are duplicate elements of 9,11,14,17,20,27,28. I want final matrix without those duplicate elements. while removing those duplicates I hav a criterion which is i should have only that duplicate whose corresponding ampmat value is maximum among its duplicates i.e., 20 has three duplicates with ampmat values 3.345146553, 3.363855225,2.433320998.

I want 20 corresponding to max 3.3638.my final matrices should be

fin1 = [1 2 3 4 5 6 7 8 9 11 13 14 15 16 17 18 20 22 23 24 26 27 28 ];

fin2 =[68.75539589 70.70627741 72.0721373 80.32433467 8.875643035 4.472189209 1.966101838 1.418783172 0.919213277
 0.715597877 0.688455694 1.045734641 1.827282907 3.753959435 5.614435942 3.708414655 3.363855225 1.738680617 1.199803437 0.82070146 0.782401601 1.181695482 1.519064218 ]

Plz help me with code

Subject: Remove Duplicate Values according to criterion

From: Roger Stafford

Date: 11 May, 2012 18:58:28

Message: 2 of 3

"Shantharam " <ksramrepome@gmail.com> wrote in message <jojhvn$coj$1@newscl01ah.mathworks.com>...
> I have two matrices
>
> ampmat = [68.75539589 70.70627741 72.0721373 80.32433467 8.875643035 4.472189209 1.966101838 1.418783172 0.919213277 0.812347605 0.715597877 0.656760549 0.688455694 0.859875845 1.045734641 1.827282907 3.753959435 5.614435942 3.646970094 3.708414655 3.345146553 3.363855225 2.433320998 1.738680617 1.199803437 0.82070146 0.782401601 0.96851817 1.181695482 1.519064218 1.344429667 0.720952257];
>
> decisionmat = [1 2 3 4 5 6 7 8 9 9 11 11 13 14 14 15 16 17 17 18 20 20 20 22 23 24 26 27 27 28 28 27];
>
> Here each element of decisionmat corresponds each element of ampmat respectively. i.e., 1 corresponds to 68.75, 2 corresponds to 70.70 and so on.
>
> Now we can see that in decisionmat there are duplicate elements of 9,11,14,17,20,27,28. I want final matrix without those duplicate elements. while removing those duplicates I hav a criterion which is i should have only that duplicate whose corresponding ampmat value is maximum among its duplicates i.e., 20 has three duplicates with ampmat values 3.345146553, 3.363855225,2.433320998.
>
> I want 20 corresponding to max 3.3638.my final matrices should be
>
> fin1 = [1 2 3 4 5 6 7 8 9 11 13 14 15 16 17 18 20 22 23 24 26 27 28 ];
>
> fin2 =[68.75539589 70.70627741 72.0721373 80.32433467 8.875643035 4.472189209 1.966101838 1.418783172 0.919213277
> 0.715597877 0.688455694 1.045734641 1.827282907 3.753959435 5.614435942 3.708414655 3.363855225 1.738680617 1.199803437 0.82070146 0.782401601 1.181695482 1.519064218 ]
>
> Plz help me with code
- - - - - - - - -
 [a,p] = sort(ampmat);
 [fin1,m] = unique(decisionmat(p),'last');
 fin2 = a(m);

Roger Stafford

Subject: Remove Duplicate Values according to criterion

From: Shantharam

Date: 12 May, 2012 05:26:26

Message: 3 of 3

"Roger Stafford" wrote in message <jojngk$92j$1@newscl01ah.mathworks.com>...
> "Shantharam " <ksramrepome@gmail.com> wrote in message <jojhvn$coj$1@newscl01ah.mathworks.com>...
> > I have two matrices
> >
> > ampmat = [68.75539589 70.70627741 72.0721373 80.32433467 8.875643035 4.472189209 1.966101838 1.418783172 0.919213277 0.812347605 0.715597877 0.656760549 0.688455694 0.859875845 1.045734641 1.827282907 3.753959435 5.614435942 3.646970094 3.708414655 3.345146553 3.363855225 2.433320998 1.738680617 1.199803437 0.82070146 0.782401601 0.96851817 1.181695482 1.519064218 1.344429667 0.720952257];
> >
> > decisionmat = [1 2 3 4 5 6 7 8 9 9 11 11 13 14 14 15 16 17 17 18 20 20 20 22 23 24 26 27 27 28 28 27];
> >
> > Here each element of decisionmat corresponds each element of ampmat respectively. i.e., 1 corresponds to 68.75, 2 corresponds to 70.70 and so on.
> >
> > Now we can see that in decisionmat there are duplicate elements of 9,11,14,17,20,27,28. I want final matrix without those duplicate elements. while removing those duplicates I hav a criterion which is i should have only that duplicate whose corresponding ampmat value is maximum among its duplicates i.e., 20 has three duplicates with ampmat values 3.345146553, 3.363855225,2.433320998.
> >
> > I want 20 corresponding to max 3.3638.my final matrices should be
> >
> > fin1 = [1 2 3 4 5 6 7 8 9 11 13 14 15 16 17 18 20 22 23 24 26 27 28 ];
> >
> > fin2 =[68.75539589 70.70627741 72.0721373 80.32433467 8.875643035 4.472189209 1.966101838 1.418783172 0.919213277
> > 0.715597877 0.688455694 1.045734641 1.827282907 3.753959435 5.614435942 3.708414655 3.363855225 1.738680617 1.199803437 0.82070146 0.782401601 1.181695482 1.519064218 ]
> >
> > Plz help me with code
> - - - - - - - - -
> [a,p] = sort(ampmat);
> [fin1,m] = unique(decisionmat(p),'last');
> fin2 = a(m);
>
> Roger Stafford

Thank You Very much Roger
Shantharam

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us