shapewrite(Data(:), 'EBB_current.shp');
Created Shape file from matrices
9 次查看(过去 30 天)
显示 更早的评论
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');
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Structures 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!