Code covered by the BSD License  

Highlights from
jointable

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

jointable

by Ben Petschel

 

15 Sep 2009 (Updated 24 Sep 2009)

Join pairs of tables using arbitrary keys

| 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)
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

Contact us at files@mathworks.com