Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how to check values from a table in MAtlab

Status
Not open for further replies.

moonnightingale

Full Member level 6
Joined
Sep 17, 2009
Messages
362
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,298
Activity points
3,832
The problem is little simple but i am stuck up Kindly help me for MATLAB

I have a large matrix having abount 2000 rows and 3 coulmns

A= [1 2 3
7 8 9
1 2 3
- - -- - - - ---
---------------
------------
--------------
till 2000 ]

out of these 2000 rows, each row is already present in lookup table in C

for example my look table is like this

B= [ 0 4 3 4 3 4]
8 4 3 4 3 4
5 3 2 4 3 4
------------------
--------------
till 20]

C= [ 1 2 3
7 8 9
6 5 4
-----
-----
till 20

So what i want each row of A first compares itself with C and after getting match in C, it gets the value which is written against B.

So at the end i will again have another Matrix D

having 2000 rows just like B
Hope u got me
For simple understanding it is lookup table
 

This will do what you want

D = zeros(size(A,1),size(B,2));

for i=1:size(A,1)
[tf, loc] = ismember(A(i,:), C, 'rows');
D(i,:) = B(loc,:);
end

I'm assuming that there aren't any duplicate rows in your Matrix C (which should be the case in a look-up table).
 
Thanks alot

You solved my big problem it is working excellent

Can u kindly explain this as well to me.
I will be highly grateful to you
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top