Re: union table
- To: mathgroup at smc.vnet.net
- Subject: [mg108157] Re: union table
- From: Nicola Mingotti <n-no-mingotti at g-spam-mail.com>
- Date: Tue, 9 Mar 2010 06:25:03 -0500 (EST)
- References: <hn2mg7$47r$1@smc.vnet.net>
On 2010-03-08 12:19:35 +0100, maria giovanna dainotti said: > Dear Mathgroup, > I need to join two table in which one column should be the same. And if= > it is not the same at the same position I would like to find the way > that Math can match the column when for example the tenth column of the= > first table should be the same of the forth column of the second table. > > AI could do also with a do operation but the lenght of the table can be= > also different. > > Is there a more general method to figure out this problem? > for example with union Union[{DataFitend},{DataFitLx}] > it returns all the table instead I would like to eliminate one column > that it is the same. > how can i do? > Thanks a lot > Maria Hello, I don't know if i understood well but the problem could be that what you consider two "equal" list are not precisely the same. 1) In this case it works as expected a = {{1, 2, 3}, {4, 5, 6}}; b = {{1, 2, 3}, {7, 8, 9}}; In[40]:= Union[a, b] Out[40]= {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}} 2) in this case don't : a = {{1.0, 2, 3}, {4, 5, 6}}; b = {{1, 2, 3}, {7, 8, 9}}; Union[a, b] => {{1, 2, 3}, {1., 2, 3}, {4, 5, 6}, {7, 8, 9}} .... because 1 can be considered equal to 1.0 but even not, it depends on how you define equality. bye nicola