So I felt like making it interactive so I used the built in guide function in matlab to create a GUI. Attached are the two files. Basically it lets you type in the x and y intervals for your grid. Then upon clicking update it will show the grid lines, put a red star at the center of each grid box that it believes the black dot is in and then will do a basic check for costas array.
Inside the m file is a lot of stuff that makes the gui work. You don't need most of it but I put a big stuff happens here comment to help find the main things. There is a function called testCostaArray where I do the test to see if any of the points are in the same column or horizontal. I think it should be set up well enough to let you check for the other conditions that make something a costas array since I did not put those in.
Godd luck, hope this helps.