Got Questions? Get Answers.
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:
need help in data reduction..

Subject: need help in data reduction..

From: anil chandy

Date: 19 Jan, 2009 12:49:01

Message: 1 of 2

i have two matrixes for eg
a=[68;34;69;12;30;29;90;38;10;59;40]
 b=[12;3;4;4;12;3;6;7;7;8;12]
here b is formed by masking the last two bits of each element in a ..
here 68, 30, 40 in matrix a corresponds to 12 in b. 34,29 etc corresponds to 3....so i have to find the coorresponding elements in a for the repeating elements in b.. in this eg for 12,3,4,7 etc..

then i have the find the average of the elements (eg average of 68,30,40).. can anyone pls help me out..

Subject: need help in data reduction..

From: Steven Lord

Date: 19 Jan, 2009 14:22:52

Message: 2 of 2


"anil chandy" <anilvchandy@gmail.com> wrote in message
news:gl1srt$aaj$1@fred.mathworks.com...
>i have two matrixes for eg
> a=[68;34;69;12;30;29;90;38;10;59;40]
> b=[12;3;4;4;12;3;6;7;7;8;12]
> here b is formed by masking the last two bits of each element in a ..

?

When written in binary, 68 is 1000100 -- "masking the last two bits of each
element of a" would give you 68 (if by 'masking' you mean 'setting to zero')
or 17 (if by 'masking' you mean 'a right-shift by two places'), not 12.

> here 68, 30, 40 in matrix a corresponds to 12 in b. 34,29 etc corresponds
> to 3....so i have to find the coorresponding elements in a for the
> repeating elements in b.. in this eg for 12,3,4,7 etc..

Use UNIQUE on B, and then use one of the outputs of UNIQUE as indices into
A. I'll let you figure out the details.

> then i have the find the average of the elements (eg average of
> 68,30,40).. can anyone pls help me out..

HELP MEAN.

--
Steve Lord
slord@mathworks.com

Tags for this Thread

No tags are associated with 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