Created Shape file from matrices

26 visualizzazioni (ultimi 30 giorni)
Dear all,
i would like to convert a matlab file into a shape file. I wrote the code below, however an error message is still appearing (sea below), does someone have any ideas how to solve it, pelase?
Error message:
error using shapewrite
Expected input number 1, S, to be a vector.
Error in shapewrite>parseInputs (line 667)
validateattributes(S, ...
Error in shapewrite (line 82)
[S, basename, dbfspec] = parseInputs(varargin{:});
Error in average_current (line 137)
shapewrite(Data, 'EBB_current.shp');
%% Convert to shape file
clear all
close all
clc
% assign the path to your working directory:
cd ('E:\publi\Waiting-room\bird_swnasea\Velocity_file\');
file = 'Average_EBB.mat';
load(file,'U','V');
Data = struct([]) ; % initilaize structure
for i = 1:141 % number lines of matrices U and V
for j = 1:161 %number of column of matrices U and V
Data(i,j).Geometry = 'Polygon' ;
Data(i,j).X = U(i,j) ; % latitude
Data(i,j).Y = V(i,j); % longitude
Data(i,j).Name = 'EBB' ; % some random attribute/ name
end
end
shapewrite(Data, 'EBB_current.shp');

Risposta accettata

Walter Roberson
Walter Roberson il 29 Lug 2022
shapewrite(Data(:), 'EBB_current.shp');

Più risposte (0)

Categorie

Scopri di più su Entering Commands in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by