5

0

I would like to "write" on to a matrix using the mouse. That is, I would like to use the integer value of Locator coordinates (p) to index a matrix. Then, if the mouse button is down, write a 1 in that location. That approach doesn't seem to work since, when attempting to do something like M[[Sequence @@ Round [p]]], the coordinate p is actually a dynamic quantity, which can't be converted to two integer indices by Sequence @@ Round.

Is there any way to do this? or, Is there an equivalent workaround that gets the same result. The simplest example would be using the mouse to input a freehand black and white drawing as pixels on a matrix, which could later be subject to image processing algorithms.

Related: https://mathematica.stackexchange.com/q/51952/7339

– expression – 2021-01-30T07:11:21.763Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by

– Vitaliy Kaurov – 2013-04-03T03:26:34.277answering questionsin your area of expertise. 2)`Read the FAQs`

! 3) When you see good Q&A, vote them up by`clicking the gray triangles`

, because the credibility of the system is based on the reputation gained by users sharing their knowledge. ALSO, remember to accept the answer, if any, that solves your problem,`by clicking the checkmark sign`

`