We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hey erryone. I looking for an equation or two where i would be able to input a number, maybe from 0-24, and then get the x and y coordinates for a 5x5 matrix. if read a bunch of posts, but they all seem to use for loops, but that seems time consuming for my project.
I would like them mapped like this;
0,1,2,3,4
5,6,7,8,9
10,11,12,13,14
15,16,17,18,19
20,21,22,23,24
Answers
Let's make a matrix of 3x6 instead of 5x5 in order to be able to identify the dimensions directly, so 3 rows and 6 columns.
You have an input number named val. We know that val is constrained between 0 and 3*6-1. Then to get the column you do col=val%6 and similarly for rows, row=int(val/6).
Kf