Be the first to rate this file! 100 downloads (last 30 days) File Size: 2.85 KB File ID: #25311

jointable

by Ben Petschel

 

15 Sep 2009 (Updated 24 Sep 2009)

Code covered by BSD License  

Join pairs of tables using arbitrary keys

Download Now | Watch this File

File Information
Description

usage: jointable(tab1,tab2,keys1,keys2,fillval)

JOINTABLE works much like an SQL join, where each row of the join corresponds to rows of the tables with matching keys. Positions corresponding to non-matching keys are filled with the specified value.

Examples:

jointable([1;2;3],[4;5],{'a','b','c'},{'a','b'}) % join on string keys
jointable({'a';'b';'c'},{'d';'e'},[1,2,3],[1,2]) % join on numeric keys
jointable([1;2;3],[4;5],ones(1,3),ones(1,2)) % join on non-unique keys

The treatment of non-unique keys differs from that of an SQL full outer join.

NOTE: Requires LEXCMP (see below).

See the help for more details.

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
lexcmp

MATLAB release MATLAB 7.8 (R2009a)
Zip File Content  
Other Files jointable.m,
license.txt
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Tag Activity for this File
Tag Applied By Date/Time
join Ben Petschel 29 Sep 2009 12:34:52
sql Ben Petschel 29 Sep 2009 12:34:52
jointable Ben Petschel 29 Sep 2009 12:34:52
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com