How to convert matrix indexes to cartesian coordinates
Show older comments

Given a matrix a shown above, i want to convert the cell indexes into cartesian coordinates. I am trying to figure out what these indexes represent: is it the center of the cell? or the left corner of the cell? Thanks.
2 Comments
TADA
on 24 Aug 2019
It's both, it's neither... If this is for visualization, I'd prefer the center of the cell But generally its up to you to decide
Tchilabalo
on 25 Aug 2019
Accepted Answer
More Answers (1)
David Hill
on 24 Aug 2019
n=3;%nxn matrix
a=1:n^2;
x=floor((a-.1)/n)+1;
y=mod(a,n);
y(find(y==0))=n;
plot(x,y,'LineStyle','none','Marker','o',"Color",'b');
1 Comment
Tchilabalo
on 25 Aug 2019
Categories
Find more on Medical Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!