How to create a matrix?

1 Ansicht (letzte 30 Tage)
Aarti Soni
Aarti Soni am 17 Mai 2022
Kommentiert: Aarti Soni am 18 Mai 2022
Hello everyon,
I want to creat a latitude and longitude matrix (180 X 360). The interval is given below:
longitude = 0.25:1:359.75;
latitude = -89.75:1:89.75;
Thanks in advance

Akzeptierte Antwort

Matt J
Matt J am 17 Mai 2022
Do you mean this?
[lat,long]=ndgrid(-89.75:89.75,0.25:359.75);
  3 Kommentare
Matt J
Matt J am 17 Mai 2022
How about
[lat,long]=ndgrid(-89.75:89.75,0.25:359.75);
matrix=cat(3,lat,long);
so that now, matrix(i,j,:) gives a lat/long pair?
Aarti Soni
Aarti Soni am 18 Mai 2022
It is not giving desired output

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Matrices and Arrays finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by