Borrar filtros
Borrar filtros

how to write long field name in a shape file?

4 visualizaciones (últimos 30 días)
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

Respuesta aceptada

Rachana Reddy Mamilla
Rachana Reddy Mamilla el 2 de Ag. de 2018
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

Más respuestas (0)

Categorías

Más información sobre Structures en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by