# Assigning the Values to 2-D Matrix which has 2 Elements in Each Point

1 view (last 30 days)
tinkyminky93 on 29 Mar 2022
Commented: Torsten on 29 Mar 2022
Hello, I am trying to assign the values to a matrix. This matrix is a 3x3 matrix but every point has 2 elements, which are the coordinates of a point, in other words x and y values.
For example I want this matrix to be in the form of:
[0 500] [100 500] [200 500]
[0 250] [100 250] [200 250]
[0 0] [100 0] [200 0]
The Y values are 0, 250, 500 and the X values are 0, 100, 200 respectively. I tried to assign values by using for loop but I could not achieve the assignment of 2nd element. Can you help me? Thank you.
Torsten on 29 Mar 2022
I just wanted to say that - although complex numbers are in principle tuples of real numbers - they can be assigned to matrix elements. Also, rules how to add, subtract, multiply and divide such matrices are already implemented.
For your case, when you work with cell arrays - these rules are not yet available and you had to define and implement them on your own.

David Hill on 29 Mar 2022
Sounds like you need two matrices. A x matrix and a y matrix.
[x,y]=meshgrid(0:100:200,0:250:500);
tinkyminky93 on 29 Mar 2022
I see sir, I understood. I asked one more and the last question above.

### Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

R2021b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by