Create Size 256 × 150 image that have 256 colors on it starting 0 till 255 (the first row is black, the last row is white, and in between all the gray shades).

1 view (last 30 days)
.Create Size 256 × 150 image that have 256 colors on it starting 0 till 255 (the first row is black, the last row is white, and in between all the gray shades).

Accepted Answer

DGM
DGM on 11 May 2022
Something like this:
A = uint8(repmat((0:255).',[1 150]));
imshow(A)
  3 Comments
Abd a
Abd a on 11 May 2022
Thank you, but I put the question after I searched. I am still learning and I just wanted to create the image, but it appeared in one color, and this is not homework. <3
DGM
DGM on 12 May 2022
Edited: DGM on 12 May 2022
It didn't really seem like an obvious homework assignment to me. Granted, it's often difficult to distinguish a slightly-abstracted statement of a beginner problem from a contrived homework problem.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!