MATLAB Answers

convert orderd vector into a matrix

30 views (last 30 days)
giacomo labbri
giacomo labbri on 13 Jan 2021
Edited: Matt J on 17 Jan 2021
Hello everyone,
I am trying to understand how to convert ordered vector into a matrix. Here is my problem:
The correspoding values are identified by their position in the vector. This is to say that at the location lat(1)=4 e lon(1)=32 there was a wind speed of wind_speed(1)=12.
What I would like to have is two vector of lat and lon with unique and ordered values and a 2D matrix of wind values. My aim is to plot it with the function contour as
where X and Y are the new vector of ordered and unique lon and lat values and win_spd is a matrix with the the dimesion of X by Y.
Any help is greatly appricieted!
Stephen Cobeldick
Stephen Cobeldick on 17 Jan 2021
"just out of curiosity what if I had no NaN?"
The issue is not the NaN per se, but what kind of interpolation depends on if the input data are gridded or scattered:
There are many ways that scattered data could be stored: in vectors, in a matrix (with NaN values), etc.
Gridded data cannot contain NaN values.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by