File Exchange

image thumbnail

Surfer Griddata

version 1.0 (3.85 KB) by

A gridding interface with surfer (v7). Works just like griddata.

4.08333
12 Ratings

2 Downloads

Updated

No License

A replacement for griddata for those that have golden softwares Surfer.

(Very fast compared to griddata for my test dataset!)

Usage:
[Xi,Yi,Zi]=surfergriddata(X,Y,Z,Xi,Yi,method) or
[Xi,Yi,Zi]=surfergriddata(X,Y,Z) or
[Zi]=surfergriddata(X,Y,Z,Xi,Yi,method) or

methods:
InverseDistance, Kriging(default), MinCurvature, NaturalNeighbor, NearestNeighbor, RadialBasis, Regression, Shepards, Triangulation

-------------------
Aslak Grinsted 2006

NOTE: Requires Golden Software Surfer (only tested in surfer7).

Comments and Ratings (23)

finally i found the solution for Luke Garden and me related to specify the grid spacing. You can try to specify the grid like this:

data=load('datasvd.txt');
x=data(:,1);
y=data(:,2);
g=data(:,3);
spasigrid=250;
tixx=min(x):spasigrid:max(x);
tiy=min(y):spasigrid:max(y));
[XI,YI]=meshgrid(tix,tiy);
[Zi]=surfergriddata(x,y,g,XI,YI

if we wanto to use this command [Xi,Yi,Zi]=surfergriddata(X,Y,Z,Xi,Yi,method)

what must be filled in Xi and Yi?
i hope we can input the grid spacing in there
thanks


i have some problem with specify the grid spacings because the adjusment of grid spacing is quite important for depth estimating

Luke Garden

Is there any way to add some code to specify the grid spacings?

csu go

csu go (view profile)

What is srfDupAvg at 82 means?

Anthony Kendall

Nice, simple function that can easily be modified to add additional options to the interpolations. Thanks!

Marcelo Lago

Working fine by using Surfer version 9.3.451 and MatLab version 7.6.0.324 (R2008a)

Milan Zukovic

I'm getting the same error as huli huo even using surfer 7. Any idea?
??? Invoke Error, Dispatch Exception:
Source: Surfer.Application.1
Description: Parameter 9 must be >= 2 and <= 10000
Module Surfer, File D:\gs\Surfer7\Automation\Automation.cpp, Line 381
Help File: C:\Program Files (x86)\Golden Software\Surfer\Surfer.hlp
Help Context ID: 13e1.

wang peng

Some people help me solve this problem?
I want Painting contour with Surfer8 in Matlab7.0,my program is:

srf=actxserver('surfer.application');
%Surfer Griddata;export surfer .grd file;
invoke(srf,'griddata',......)
wds=invoke(srf.documents,'add',1);
%contourmap;
frame=invoke...(wds.shapes,'AddContourMap',outgrid)contourmap=frame.Overlays(1);
%then,I want to fill the contourmap,but error occured.
set(contourmap,'fillcontours',1);
??? Invoke Error: Unknown name or named argument
It means contourmap does not have fillcontour methods.It's different with surfer8 Automation.WHY?
THANKS!

Aslak Grinsted

It works. You just need Surfer v7 as it says in the documentation above (huli huo has v8). If you want it to work in v8 then you need to modify it abit according to your new documentation.

chen xb

thank you for your advising

huli huo

Does not work, and error message:
??? Invoke Error, Dispatch Exception:
Source: Surfer.Application.1
Description: Parameter 9 must be >= 2 and <= 10000
Help File: C:\PROGRA~1\Golden Software\Surfer8\Surfer.chm
Help Context ID: 313e1.

kitty abbey

appreciate

bobby SKUNE

interesting

Sky Wood

good

Xingliang Huo

Thanks a lot!

Dr.Jibendu Mantri

research

José Carlos Nunes

Aslak Grinsted

It means that you don't have surfer installed properly (ie with activex support). Did you read the help? Note that golden software surfer (v7) is required. I will update the code to give a more telling error description.

If you dont have surfer, then i recommend gridfit also found on matlabcentral.

RR DD

Doesn't work, get this error:

??? Undefined command/function 'actxserver'.

Error in ==> surfergriddata at 82
srf=actxserver('surfer.application');

Absolutely no idea what it means.

Wolfgang Schwanghart

Works pretty fine after a modification. In line 79 the function txtsave is not working. I changed it to dlmwrite and it worked...

Aslak Grinsted

The txtsave dependency has been removed and that problem has been fixed.

J. Luis

Not working. What is the txtsave function?

Updates

Fixed broken code... The old version relied on a homemade function (txtsave). Now it uses matlabs save.

MATLAB Release
MATLAB 7.1.0 (R14SP3)
Acknowledgements

Inspired: gridding_surfer

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video