create 256* 256 matrix with loop values 0 to 7

2 views (last 30 days)
Aberna P
Aberna P on 26 May 2022
Commented: Aberna P on 27 May 2022
How to Create Matrix of size 256*256 with the values 0 to 7 filled in row-wise manner?

Accepted Answer

Chunru
Chunru on 26 May 2022
x = repmat(0:7, 256, 32)
x = 256×256
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5
  3 Comments
Chunru
Chunru on 26 May 2022
Can you give more details of "selecting matrix values in hexagon shape" with an example if possible?

Sign in to comment.

More Answers (2)

Aberna P
Aberna P on 27 May 2022
Reference matrix based turtle shell....

Aberna P
Aberna P on 27 May 2022
  1 Comment
Aberna P
Aberna P on 27 May 2022
Need to select the matrix in this format for the above shiwn 256*256 matrix

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!