how to create increasing number pyramid matrix?
Show older comments
hello,
how do I create a matrix of the form:
1 2 3 4 5
6 7 8 0 0
9 10 0 0 0
11 0 0 0 0
in this example N=5. I need a solution for any N.
EDIT:
I'm performing manual clustering. in this example of five points. points 1&2 have been clustered together to a new point - 6. points 3&4 have been clustered together to a new point - 7. points number 5 was reassigned to point 8, and so on.
thanks
3 Comments
Please explain your example matrix. You write that "in this example N=5", so what determines that there should only be four rows? Why is the second row apparently missing?: if we count the number of zeros in each row, we get this:
1 2 3 4 5 -> 0
6 7 8 0 0 -> 2
9 10 0 0 0 -> 3
11 0 0 0 0 -> 4
Where is the row with just one 0?
yonatan s
on 13 Jan 2019
Rik
on 13 Jan 2019
Or is this the N=6 output?
1 2 3 4 5 6
7 8 9 0 0 0
10 11 0 0 0 0
12 0 0 0 0 0
(halving the number of non-zero elements on each row (rounding up), making each non-zero element a unique value)
Accepted Answer
More Answers (0)
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!