IS this a small bug in Matlab?

Hi, all

Try this code in Matlab:

oldpath = path; 
path(oldpath,'C:\programs\gmt6\bin'); % Add GMT path

% Not work 
order='grdmath -R107/111/15/19 -A10000/0/4 -Dl -I2m LDISTG = ../temp/dist_to_gshhg_hn2.nc';
gmt(order); 

% Fine
order='grdmath -R107/111/15/19 -A10000/0/4 -Dc -I2m LDISTG = ../temp/dist_to_gshhg_hn2.nc';
gmt(order); 

If I use the -Dl, the Matlab will force to quit without any warning.
If use the -Dc, it will be ok.

I try the code in Linux shell, and the grdmath -R107/111/15/19 -A10000/0/4 -Dl -I2m LDISTG = ../temp/dist_to_gshhg_hn2.nc just gives lot of waring, but it will create the file.

So, guess this maybe a small problem in Matlab only.

The GMT is 6.1, and Matlab is R2018b.

Works fine here, both command line, Julia or Matlab

oo

May be that is my computer bug…

This is never the computer’s fault. You said that the version in command line printed many warnings. Can you post some here?

Sorry. I can not reproduce the warning messages now. It is fine in the shell now.

But the Matlab is still forced to quit when use -Dl for some specific areas. It is not always quit. Just for specific cases.

I do not know why. And will post message here when it shows up again.

Which is also strange because those Matlab killings are caused by exit calls in the C code and we shouldn’t have any exit anymore.

Depends on GMT version I think, Which one is this?

OK.
I got the warning message after changing to other specific area:

yangleir@DESKTOP-FVRFATD MINGW64 ~/Desktop
$ gmt grdmath -R119/124/31/37 -A10000/0/4 -Dl -I2m LDISTG = dist_to_gshhg_hn2.nc
grdmath [WARNING]: Near- or actual antipodal points encountered. Precision may be reduced slightly.
grdmath [WARNING]: Near- or actual antipodal points encountered. Precision may be reduced slightly.
grdmath [WARNING]: Near- or actual antipodal points encountered. Precision may be reduced slightly.
grdmath [WARNING]: Near- or actual antipodal points encountered. Precision may be reduced slightly.
grdmath [WARNING]: Near- or actual antipodal points encountered. Precision may be reduced slightly.
grdmath [WARNING]: Near- or actual antipodal points encountered. Precision may be reduced slightly.
grdmath [WARNING]: Near- or actual antipodal points encountered. Precision may be reduced slightly.
...
a lot same messages

Please try:


oldpath = path; % 
path(oldpath,'C:\programs\gmt6exe\bin'); % Add GMT path

order='grdmath -R119/124/31/37 -A10000/0/4 -Dl -I2m LDISTG = ../temp/dist_to_gshhg_hn2.nc';
gmt(order); 

order='grdmath -R119/124/31/37 -A10000/0/4 -Dc -I2m LDISTG = ../temp/dist_to_gshhg_hn2.nc';
gmt(order); 

In my computer, I have two versions of GMT. One is from the released GMT6.1.1 exe, and other is built from source code GMT6.1.0 . Both under win10.
Since it not easy to built GMT in win10. I just tried one time and not update it after that.

In addition, I found the self-built GMT from source code is some slower than that from exe.

This one also killed my Matlab but the same command worked in Julia. Odd.

Regarding building on Windows, you may try this.
Maybe you have build your 6.1.0 in debug mode. Those builds are slower than the distributed .exe

Those antipolda point warnings are indeed annoying. Only one should be displayed I think (or a summery of how many points). And I think warning is not needed - perhaps relegate to -V level of information.