File Exchange

image thumbnail

Solve Magic Square

version 1.1 (3.78 KB) by

Find all combinations of entries in a matrix which sum equals a certain number up to eps precision.



View License

Find all combinations of entries in a matrix (or vector) which sum equals a certain number. In addition to the matrix, the length of the combination (two entries, three entries, ...) as well as the numerical value to match can be supplied. Works as well on vectors.

Returns the combination and the indices of the combinations.

Since it uses brute force to try all possible combinations the time strongly depends on the size of the matrix and the length of the combination.

Comments and Ratings (0)



Added floating point precision, progress should not decrease due to the polynom behind it

MATLAB Release
MATLAB 7.11 (R2010b)

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today