how to write long field name in a shape file?
2 ビュー (過去 30 日間)
古いコメントを表示
Reema Alhassan
2018 年 7 月 18 日
回答済み: Rachana Reddy Mamilla
2018 年 8 月 2 日
Hello everyone , I need to write new column in a shape file so I used setfield function
SumOfLightColumn=strcat('Sum','20150201_20150228');
SumOfLightColumn=char(SumOfLightColumn);%%convert it to character because it is a cell araay
shapeToTable=struct2table(shape);
n=num2cell(a); %%convert the a column vector from double to cell array so i can write in the table
s=setfield(shapeToTable,SumOfLightColumn,n); %%n is a after convertion to a cell array
w = table2struct(s);
shapefile1=fullfile(shapeFolder,baseShape); %%this the the path of the shape file
shapewrite(w,shapefile1);
but the output of the field name is :Sum20150201 and when I run it for the second time it writes another column :Sum201502011 it doesn't take the whole name like this :Sum20150201_20150228
Does anyone know how to fix this? the attachment is a screenshot of the output shape file
0 件のコメント
採用された回答
Rachana Reddy Mamilla
2018 年 8 月 2 日
Hello Reema, You cannot create fields whose size is greater than 11 characters using shapefile. Hence you face that issue. As you keep adding a column with the same field name, it keeps adding with a subscript. Ex. A file once saved as shape if you try to resave it, it gets saved as shape (1), shape(2) etc. It’s similar to this. You can refer to “When should I not use a shape file” in http://webhelp.esri.com/arcgisdesktop/9.3/index.cfm?TopicName=Geoprocessing_considerations_for_shapefile_output
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!