User Input From a Grid

6 views (last 30 days)
Jake
Jake on 22 May 2013
I want to display an image with a grid, have the user select different colors in a GUI and click on the grid. Once they click, that box in the grid turns into the color they chose.
I found an answer on Matlab Central that said that I should use imagesc to display the image, which I have successfully done, albeit without a grid. Next, I want to define a variable A = zeros(N,N). N will be the number of rows and columns in my grid. Then, when the user clicks one box in the grid, the respective 0 in the matrix A will change to a different number (Zdata?).
So in the GUI if the user selects blue and clicks on the box in row 50, column 50, then A(50,50) will change to 2 (2 being the number that stands for blue). Then the user may click more boxes with blue or choose orange, and while still keeping the blue dots, be able to click on the grid with orange.
I'm pretty much a beginner learning how to use Matlab so anything advanced will be tough for me to follow. However, any help is appreciated. Thanks!

Answers (0)

Community Treasure Hunt

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

Start Hunting!