Is there a way to create a matrix off the grid boxes of a gridded image on a gui?

Is there a way to do this? I have a gridded image on a gui. The user can fill in the grid boxes on the gui, and now I have to save the graph as a matrix text file.
Save the grid as a NxM zero-matrix (you know the dimension of your grid). Consider each box in your grid as a index of the matrix. Initially all boxes are unclicked by the user and hence all indices are zero. But when user clicks on a box, that corresponding matrix index will be 1 and all others still 0. Once you get the matrix, you can just write it in a text file. So basically the the text file will be a NxM matrix of 0s and 1s - representing the grid.

Answers (1)

Why can't you just use imwrite() or fprintf()? Type alt-PrintScreen to copy a screenshot to the clipboard, and then upload a screenshot to help explain better what is going on to http://snag.gy

2 Comments

thats what the image with the grid looks like. I'm hoping to make a matrix of 0's for all the empty squares and a 1 for the red squares and a 2 for the green squares.
also, on that note, the green and red squares are added by the user with a ginput(1) button command

Sign in to comment.

Asked:

Rob
on 9 Jun 2013

Community Treasure Hunt

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

Start Hunting!