Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
problem using shapewrite

Subject: problem using shapewrite

From: Jonathan

Date: 5 Mar, 2010 05:42:05

Message: 1 of 2

Hi,

I have created the following mapstructs file so that I can export the coordinate information as a shapefile, which can be opened in ArcGIS. My code is as follows:

fname=sprintf('CoosCty_CoastalStats.xlsx');
fname2=sprintf('CoosCty_CoastalStats');
Data = xlsread(fname, fname2, 'A4:D19');

id = Data(:,1); %1,2,3,4,...
X = Data(:,2); %1171161.403,1171200.82,...
Y = Data(:,3); %142616.162,142637.881,...
z = Data(:,4); %74, 79,...

[pfd.Geometry] = deal('MultiPoint');
pfd.id = id;
pfd.X = X;
pfd.Y = Y;
pfd.z = z;
shapewrite(pfd, 'pfd');

I am experiencing an error on the last line. The error message I get is

"Attribute field z of geographic data structure S contains
at least one value that is not a scalar double."

It actually hangs when trying to convert both id and z variables above. I have no idea what is wrong with my code. Any help would be much appreciated.

Thanks
Jon

Subject: problem using shapewrite

From: Jonathan

Date: 7 Mar, 2010 14:42:13

Message: 2 of 2

"Jonathan" <jkakiwi@yahoo.co.uk> wrote in message <hmq5jd$9bd$1@fred.mathworks.com>...
> Hi,
>
> I have created the following mapstructs file so that I can export the coordinate information as a shapefile, which can be opened in ArcGIS. My code is as follows:
>
> fname=sprintf('CoosCty_CoastalStats.xlsx');
> fname2=sprintf('CoosCty_CoastalStats');
> Data = xlsread(fname, fname2, 'A4:D19');
>
> id = Data(:,1); %1,2,3,4,...
> X = Data(:,2); %1171161.403,1171200.82,...
> Y = Data(:,3); %142616.162,142637.881,...
> z = Data(:,4); %74, 79,...
>
> [pfd.Geometry] = deal('MultiPoint');
> pfd.id = id;
> pfd.X = X;
> pfd.Y = Y;
> pfd.z = z;
> shapewrite(pfd, 'pfd');
>
> I am experiencing an error on the last line. The error message I get is
>
> "Attribute field z of geographic data structure S contains
> at least one value that is not a scalar double."
>
> It actually hangs when trying to convert both id and z variables above. I have no idea what is wrong with my code. Any help would be much appreciated.

I'm still having problems with my code above. Could someone explain to me the hoe to convert one of my arrays to scalar double precision. I had a look around in Matlab but could not see anything obvious.

Thanks
Jon

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us