how to extract the fields header in the shape file?
6 次查看(过去 30 天)
显示 更早的评论
Is there a way to extract the fields headers in the shape file ? 13×1 struct array with fields: I need to read the headers Geometry,BoundingBox, ...
Geometry
BoundingBox
X
Y
ID_0
ISO
NAME_0
ID_1
NAME_1
HASC_1
CCN_1
CCA_1
TYPE_1
ENGTYPE_1
NL_NAME_1
VARNAME_1
DMSP_11sum
DMSP_12sum
DMSP_13sum
VIIRS_0412
VIIRS_0413
VIIRS_0414
VIIRS_Y15s
VIIRS_0415
FEB2015sum
2 个评论
Guillaume
2018-7-12
What does "extract the fields headers in the shape file" actually mean?
Do you mean that you want to retrieve the values of the Geometry field of your structure? And do what with it? Put it into a new variable. If so, this will depends on what is in Geometry (scalar values? matrices of the same size? matrices of different size?)
采纳的回答
Guillaume
2018-7-12
A complete guess as it's really not clear what you're asking: If you want to get the list of fields of a structure, use fieldnames. To then use one of these names then use dynamic field name syntax:
%get list of fields
names = fieldnames(yourstructure);
%get value of 1st field
yourstructure.(names{1}) %() to access field whose name is in names{1}
6 个评论
Guillaume
2018-7-13
t = struct2table(s); %convert structure to table
t.X = []; %remove X column
t.Y = []; %remove Y column
writetable(t, 'somefile.csv');
更多回答(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!