How to convert a row vector into 2d matrix

4 visualizzazioni (ultimi 30 giorni)
swetha S
swetha S il 6 Lug 2019
Modificato: dpb il 7 Lug 2019
I have a row vector data( 1,290). Here 290 represents 290 grid points. I want to convert this into 2d matrix (lat,lon), assigning each grid point to its corresponding lat and lon. I also have lat,lon row vectors of the order (1,290).
I don't know how to create a 2d matrix of lat,lon having the value of data
  1 Commento
dpb
dpb il 6 Lug 2019
Well, you're 289x290 items short of having enough data to assign to a 290x290 data grid.
You've only got 290 points total; where they belong in a lat/lon grid is entirely dependent upon how they were collected at what points. There's no way to know how that was done (if it was done at all) from the information supplied.

Accedi per commentare.

Risposte (1)

KALYAN ACHARJYA
KALYAN ACHARJYA il 7 Lug 2019
Modificato: KALYAN ACHARJYA il 7 Lug 2019
As per my understanding, you have to two data
  1. grid_data( 1,290) represents Grid points
  2. lat_long(1,290) represents lat and long
You wish to combine both as lat_log values with correcponding grid points
resul=[lat_long;data]';
Result mat will 2x290
Let me know!
  1 Commento
dpb
dpb il 7 Lug 2019
Modificato: dpb il 7 Lug 2019
On re-reading the Q?, I believe I misread first time but that there are actually three vectors...in order to have both lat and long position data.
posndata=[lat;long;data].';
In this case the 2D array will be 290x3 (Kalyan has inadvertently reversed row,column in his size comment)...

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by