No BSD License  

Highlights from
SETPROD

4.0

4.0 | 3 ratings Rate this file 15 Downloads (last 30 days) File Size: 938 Bytes File ID: #5898

SETPROD

by Mukhtar Ullah

 

20 Sep 2004 (Updated 27 Feb 2006)

Cartesian Product of Sets.

| Watch this File

File Information
Description

This is a compact and improved extension of cartprod.m by David Fass.

SETPROD product of multiple sets.

X = SETPROD(A,B,C,...) returns the cartesian product of the sets A,B,C, etc, where A,B,C, are numeric or character arrays.

Example: A = [-1 -3 -5]; B = [10 11]; C = [0 1];
 
X = SETPROD(A,B,C)
X =
 
  -5 10 0
  -3 10 0
  -1 10 0
  -5 11 0
  -3 11 0
  -1 11 0
  -5 10 1
  -3 10 1
  -1 10 1
  -5 11 1
  -3 11 1
  -1 11 1

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
CARTPROD: Cartesian product of multiple sets

MATLAB release MATLAB 7 (R14)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
16 Feb 2005 Marco Pausini

thanks so much

18 Feb 2006 Jos van der Geest

This snippet is badly coded, using unnecessary calls to eval and unique.

01 Oct 2009 Rob Campbell

Does the job and has been well coded since previous (now redundant) negative comment was submitted.

Please login to add a comment or rating.
Updates
24 Sep 2004

correction in the description

24 Sep 2004

The slow eval function has been removed now. The code is now even more compact and fast. The remaining eval function is only for display. Any further improvements are welcomed!

27 Sep 2004

Correction in the Description

20 Oct 2004

removed one check that required symbolic toolbox

29 Oct 2004

simplified one line

18 Nov 2004

optimised by removing repmat and employing cell

23 Feb 2005

slight improvement

27 Feb 2006

Re-written to avoid the EVAL function.

Tag Activity for this File
Tag Applied By Date/Time
cartesian product Mukhtar Ullah 22 Oct 2008 07:31:49
set Mukhtar Ullah 22 Oct 2008 07:31:49
array Mukhtar Ullah 22 Oct 2008 07:31:49
utilities Mukhtar Ullah 22 Oct 2008 07:31:49
miscellaneous Mukhtar Ullah 22 Oct 2008 07:31:49

Contact us at files@mathworks.com