Created Shape file from matrices

9 vues (au cours des 30 derniers jours)
Jonathan Demmer
Jonathan Demmer le 29 Juil 2022
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');

Réponse acceptée

Walter Roberson
Walter Roberson le 29 Juil 2022
shapewrite(Data(:), 'EBB_current.shp');

Plus de réponses (0)

Catégories

En savoir plus sur Structures dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by