Hi everyone i'm new

i am trying to write an algorithm to generate a matrix which has the following structure

(modified)

1,2

1,3

1,4

.

.

.

and so on till

1,128

then

2,3

2,4

2,5

.

.

an so on till

2,128

and so on till

127,128

after that i wil have to convert it to binary . for it i will use the in bulit de2bi function.

so i have to generate a 2×2 matrix

where the first column starts with 1 and ends with 128 and the second column starts with 2 and repeats everytime 128 is reached.

any suggestion , resources may be of great help.

the only i came up with is this

r1=[1:2]; %for the rows with 1 and inscreasing values of ii

r=[r1];

for ii=1:126

r0=[1:ii+1:ii+2];

r=[r;{r0}];

end

## Best Answer