This question is not about drawing lines in plots. I want to a function that will take effect on 2D matrices (or others) in the following way.
We have an initial matrix:
0 0 0
0 0 0
0 0 0
A line from (1,1) to (3,3) would produce the following:
1 0 0
0 1 0
0 0 1
A line from (1,2) to (3,1) would produce the following:
0 1 0
0 1 0
1 0 0
I know that I can code a function that does this, but I would like to avoid this. Thx in advance.