Matrix of numbers problem
Show older comments
hi,
I have a little challenge that I can't figure out how to code in matlab
The problem is quite simple and I can do it by hand for small matrices
Example with a 6x3 matrix:
1 3 5
2 6 4
3 1 6
4 5 2
5 4 1
6 2 3
The sum of first and second row must be equal to the sum of every column. same goes for the sum of row three and four and so on! So for the 6x3 matrix above: the sum of row 1 and 2 is 21, the sume of row 3 and 4 is 21 and the sum of row 5 and 6 is 21.. Also the sum of each column must individually be 21..
I'm doing this for a small hobby project and for about 1000 rows and 500 columns, so I figured Matlab is the way to go.
Any help is very much appreciated!
Answers (1)
G A
on 12 Mar 2012
a.*ones(1000,500)
Where a is any number. Sum of each pair of rows and sum of each column is equal to a*1000. That means that we need more specific statement of problem.
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!