f



Match data in columns and add additional data

I'd like to match a column of data between two datasets and if there is a match add a new piece of information from the second to the first. Probably easier to explain in example- I have cell arrays at the moment:

A={'Adam',2;'Bill',3}
B={'David',123;'Chris',456;'Bill',789}

I would like to return:
newA={'Adam',2,0;'Bill',3,789}

So I'd like to see if there is a match in the 'name' columns, and if there is, add information from B to the corresponding row in A. 

The 0 for Adam in the third column is a placeholder, if I could enter NaN or something else when no match is made that would work as well. 

I'm thinking of an overly complicated situation with nested loops- I'm imagining there is a simpler way with some functions but I am at a loss on what to use. Any thoughts are appreciated. Thanks. 
0
Marcus
7/28/2015 11:28:03 PM
comp.soft-sys.matlab 211265 articles. 25 followers. lunamoonmoon (257) is leader. Post Follow

0 Replies
414 Views

Similar Articles

[PageSpeed] 43

Reply:

Similar Artilces:

Data, data, data,
I have been tasked to dump around 400GB of data in physical files into a flat files and the transfer them from an iSeries 810 V5r3 to a windows server. I was going to CPYTOIMPF to a stram file and then copy over to the Windows server from the IFS. Anyone have a better idea or any suggestions? Thanks, Thad Rizzi Hi Thad If you have loads of free disk space on your 810 then your method is fine but if not you may consider Simply FTPing or iSeroes Access file transfering the files directly from the iSeries files to Windows Text file. You can get the either FTP or iSeries Access to carry out...

convert row-data to column data
I'm quite new to awk scripting, and i haven't been able to solve this problem: I have this data file: http://www.cs.kuleuven.ac.be/~bartv/downloads/sslog500_1_0p041_12.txt I would like to use the data from that datafile in gnuplot, which expects the data as columns. Now the data in my file is stored in the even rows. How do i transform the data from the even rows in to columns? The best i could come up with up until now is http://www.cs.kuleuven.ac.be/~bartv/downloads/convert.awk but this does not give me what i want. The row-data is indeed changed to column data, but the colu...

Convert rows data to column data
I have the following data returned by this query: SELECT TOP 20 t.ID, t.Name FROM tblContacts t ORDER BY t.Name ID NAME 1 Betty 3 Jane 4 Mary 2 Susan .... 20 Zelda What I want to do is to insert the results above into a temp table so that this query: SELECT Name1, Name2, Name3, Name4, .... Name20 FROM #TempTable returns the following recordset: Name1 = Betty Name2 = Jane Name3 = Mary Name4 = Susan ,,, Name20 = Zelda There will always be 20 rows created by the first query so the temp could have 20 static column names. I'm at a loss to figure out how to construct t...

Import data or Read data into Matlab
Hey everyone, Good day, I have got a problem now. I am going to read the txt file into Matlab which contains the data with the format as following (extract as instance) 0 0 1 0 1224 1223 2002 2003 2004 0 40989 3924 13599 0 502 3911 6740 2560 7984 8919 8920 1977 8422 2 3 4 4 it was separated by space, when i try to use the import data wizard, it can only read two columns, i am thinking is it because of empty area can not be recognized... Because i am going to read the entire file as a matrix. I am also trying to use the code to read, but not really works either. Can anybody help me, a...

how to store more data in data base column
hi &nbsp; i want to store 801 values in one column of data base. i tried but i was able to store/write only 10 values.can any boly help me in this matter........ I think this is the same topic. <a href="http://forums.ni.com/ni/board/message?board.id=170&amp;thread.id=322818&amp;jump=true" target="_blank">continue here</a> Is this part of a class project?&nbsp; There are two similar questions from different users. &nbsp; How were the fields defined in your database?&nbsp; Will it support 801 values? How many characters are allowed in th...

Data Entry Online, Data Format, Data Conversion and Data Entry Services through Data Entry Outsourcing
Now a day IT companies may needs to process rapidly growing amount of information. So it's becoming trends to outsource data entry work to reliable professional experts who gives excellent output with cost effective and time bound. Data Entry is the procedure of handling and processing over data. There are different forms of data entry like data entry for survey forms, legal services, entry for medical claim forms. Data for keeping track for credit and debit card transactions. Data entry can be differentiate in two forms online form data entry and offline data entry. Data Entry Online is...

Data Entry Online, Data Format, Data Conversion and Data Entry Services through Data Entry Outsourcing
Now a day IT companies may needs to process rapidly growing amount of information. So it's becoming trends to outsource data entry work to reliable professional experts who gives excellent output with cost effective and time bound. Data Entry is the procedure of handling and processing over data. There are different forms of data entry like data entry for survey forms, legal services, entry for medical claim forms. Data for keeping track for credit and debit card transactions. Data entry can be differentiate in two forms online form data entry and offline data entry. Data Entry Online is...

Data Entry Online, Data Format, Data Conversion and Data Entry Services through Data Entry Outsourcing
Now a day IT companies may needs to process rapidly growing amount of information. So it's becoming trends to outsource data entry work to reliable professional experts who gives excellent output with cost effective and time bound. Data Entry is the procedure of handling and processing over data. There are different forms of data entry like data entry for survey forms, legal services, entry for medical claim forms. Data for keeping track for credit and debit card transactions. Data entry can be differentiate in two forms online form data entry and offline data entry. Data Ent...

Data Entry Online, Data Format, Data Conversion and Data Entry Services through Data Entry Outsourcing
Now a day IT companies may needs to process rapidly growing amount of information. So it's becoming trends to outsource data entry work to reliable professional experts who gives excellent output with cost effective and time bound. Data Entry is the procedure of handling and processing over data. There are different forms of data entry like data entry for survey forms, legal services, entry for medical claim forms. Data for keeping track for credit and debit card transactions. Data entry can be differentiate in two forms online form data entry and offline data entry. Data Entry Online is...

Add one column based on the data in another column
G'day, Everyone! I have this data file. This was summarized from bigger file for test simulation. aaa.txt 01 -999.9 02 -999.9 03 -999.9 04 0.13 05 -999.9 06 -999.9 07 0.17 08 -999.9 09 -999.9 10 -999.9 11 -999.9 12 -999.9 13 -999.9 14 -999.9 15 -999.9 I am making another column based on 2nd column with these criteria. 1) All five lines should have the same value. 2) This value is come from 2nd column and should be 0 < value < 1. 3) If no value is in this range, (i.e. 11~15th lines above), just copy the values from 2nd column. This is my target array. 01 -999.9 0.13 02 -999.9 0...

Matching column data
Hello everyone. I'm attempting to write a program to deal with a portfolio of financial contracts. I've created an X:2 matrix that contains the "call" and "put" values for each contract. Since each contract is either a "call" or a "put", i'd like to match the appropriate value to each contract in a new column ("value"). The block of data that I'm analyzing has a column where each contract is marked as either "call" or "put", so I'm trying to find a way to get Matlab to check each row of that column, and p...

how to add a column to data
Hi all I face a problem,I have a data set like this; a1 a2 a3 a4,I use the box-cox transform to find the best transform for a1 is -2.5,then I try to define a new variable aa1, aa1=(a1^-2.5-1)/-2.5; and add aa1 to the data so it would look like this way. a11 a1 a2 a3 a4,how should I do,I have read the little sas book,but it seems not very helpful for this. Thanks a lot Do you want the a11 variable first in the data set or the newly created variable first any way one the tricks is assign the length of the variable like this data t; length a11 ; input; .....................;run; when ...

Matching records from data set one with records from data set two and deleting a record from data set two
Hi I need to match records from data set one with records from data set two. I can only match records from data set two to a single record in data set one. Therefore i need to delete the record in data set two or show that it has been used, and thererfore can not be used again. Have do i do that? I have been trying some thing like this: Data newdataset; set one; found=0; do i=1 to nobs until (found); set two point=i nobs=nobs; if var1=var2 (the matching criteria) then do; output; found=1; ***I need to delete the record in da...

Microcontroller, data acquision, RS232 115200Baud data send ---> Matlab RS232 data receive save to file and plot
Hello Everybody, I have a microcontroller based data acquision unit digitizing data from a 16 channels, ADC (Analog to Digital Converter) with resolution 16 bits for each channels (total 16x16=256bytes per sample) In my experiments I need to run my data acquision system for 30minutes. During this period, microcontroller based data acquision unit will sample the ADC channels not slower than 250Hz (16x16x250 = 64000 bytes per second) and send the acquired data in binary format to a PC via RS232 . The microcntroller is capable of sending upto 115200bauds. I am using Matlab 6.5, and I want to ...

Web resources about - Match data in columns and add additional data - comp.soft-sys.matlab

Category:Articles needing additional references from November 2011 - Wikipedia, the free encyclopedia ...
This is an administration category . It is used for administration of the Wikipedia project and is not part of the encyclopedia. It contains ...

Michael E. Mann - Some additional thoughts about Muller... - Facebook
Some additional thoughts about Muller and 'BEST': Muller's announcement last year that the Earth is indeed warming brought him up to date w/ ...

BranchOut raises additional $25M for professional networking app
BranchOut , a professional networking app built on top of Facebook, announced today that it raised $25 million in a Series C round lead by Mayfield ...

Swytch - Additional Numbers for Calls & Texts on the App Store
Read reviews, compare customer ratings, see screenshots, and learn more about Swytch - Additional Numbers for Calls & Texts. Download Swytch ...


TSA Interaction @ DIA Additional Body Screening After Landing???? - YouTube
They tried to get me to do additional screening of my Body after I was already off the plane and headed out of the airport. I ended up leaving ...

AGL faces delays, additional conditions after BTEX chemicals detected
AGL's coal seam gas ambitions in the Gloucester area have been dealt a double blow with the launch of two government investigations into the ...

REPORT: China is taking additional steps to shore up its shaky currency
China’s foreign exchange regulator, the State Administration of Foreign Exchange, or SAFE, has ordered banks in some trading hubs to limit dollar ...

Making additional contributions to super
Can I make additional contributions to super if the account is in the pension phase

Hunt for additional Paris attacker
FRENCH authorities are now hunting at least one additional attacker after surveillance video showed three men in a car used for an assault on ...

Resources last updated: 1/25/2016 10:06:35 AM