Matrix help in MatLab, Not the simple matrix!! I have searched, found nothing!

Please help me with this.

I need to code into matlab a function that results in a matrix answer.

It is this:
phi(i,j)=atan((eta(j)-eta(i))/(zeta(j)-zeta(i)))*180/pi]

Here is my code so far:

See I need a 4X4 matrix for phi.

I only have four etas and four zetas. both i and j = 4. With some work I can get a 4x4 matrix but it isn't coded right. It gives me the same answers in rows. It should have a diagonal line of zero's from top left to bottom right because that is where i=j

And I need to be able to change N to 250 so it needs to be easy to write for large N's

Which is basically correct BUT! Because of atan2 function, those negatives need 360 deg added. So this is what I did (worked on theta earlier in code). But it wont work this time for phi(i,j):
if phi(i,j)<0;

Re: Matrix help in MatLab, Not the simple matrix!! I have searched, found nothing!

the "error" your having might have simply been that you had variables in your work space from previous runs and playing in the command line. When you restart, you wipe your work space.

Try putting 'clear all' at the very beginning of your code, which will mimic having an empty workspace (like when you first start matlab). If you get the same error using 'clear all' then that's your problem. It means you're missing something in your code that you took for granted.

Also, you want to nest the for loops if you want to go along the matrix like you're imagining: