sergiventosa / ts-PWS

Time-scale phase-weighted stack software for seismic signal denoising
GNU Lesser General Public License v3.0
37 stars 18 forks source link

Bugs with Matlab mex functions #2

Closed asialiu closed 3 years ago

asialiu commented 3 years ago

hi, I have succeeded in compiling 'gw_IFWT' and I tried to run 'FWT_Test.m' in Matlab. But it did not work with error msg like ''array exceeds maximum array size preference''. When I compiled 'gw_IFWT', warning msg like "gw_IFWT.c:207:50: warning: passing argument 2 of 'mxCreateNumericArray_730' from incompatible pointer type [-Wincompatible-pointer-types] if (NULL == (plhs[0] = mxCreateNumericArray(2, dims, mxDOUBLE_CLASS, mxREAL) ))".

Do you know why it is like that? BTW, I tried it on Matlab 2020b. Thanks in advance.

sergiventosa commented 3 years ago

Hi, you may try changing the type of dims[2] from int to size_t. In mean, from (line 150) int ndim, dims[2], cell_dims[2], m, L, M; to int ndim, cell_dims[2], m, L, M; size_t dims[2]; I was using Matlab 2012a, when I developed these mexs. A few things have changed from that time.

I have to make an update of these codes soon!

Thanks to you! Sergi

sergiventosa commented 3 years ago

I have updated gw_IFWT.c and MatlabIO_WT.c. And the end, mwSize is best for backward compatibility and portability. Sergi

asialiu commented 3 years ago

I have updated gw_IFWT.c and MatlabIO_WT.c. And the end, mwSize is best for backward compatibility and portability. Sergi

It works. But I am encountered an anthother problem. I succeeded in compiling 'ts_pws' but I can not run 'Test_ts_pws'. It reports: 'J: Must be a positive number.'

sergiventosa commented 3 years ago

in this mex function, the default value of J was wrong. Thanks for pointing this out. I wrote these mexs just to debug the main C routines. I guess they can be useful for people working in Matlab. Sergi