Azzera filtri
Azzera filtri

From vector data to raster

2 visualizzazioni (ultimi 30 giorni)
SChow
SChow il 21 Gen 2020
I am trying to convert a vector data corresponding to countries in a shapefile to raster at 0.1 degree resolution,
For this I am using
vec2mtx
and
imbedm
functions. Here is what i was trying but MatLab throws up an error.
%%%%here states is a shapefile of the world.
states=shaperead('Z:\shpfiles\TM_WORLD_BORDERS_SIMPL-0.3.shp');
lat = [states.Y]; %%lat and lon are of size 30032x1 each and there are 246 countries in the shapefile
lon = [states.X];
%%%% I convert it to a matrix of 0.1 degree resolution
[Z, R] = vec2mtx(lat, lon, ...
10, [-90 90], [-180 180], 'filled');
%%%% The same shapefile has an attribute of literacy rate for each country, to convert the literacy rate at 0.1 degree resolution, keeping the
%%%% value constant within each country,
Z = imbedm(lat, lon, [states.Lit2005], Z, R)
%%%%%THE ERROR
Error using imbedm (line 53)
Function imbedm expected its LAT, LON, and VALUE inputs to have the same size.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by