Questions tagged «mex»

1
升级到macOS Mojave后,MATLAB不再卸载MEX文件
在MATLAB中,clear mex从内存中卸载所有MEX文件(除非它们已被锁定)。在macOS的早期版本下,我只需发出clear mex命令即可重新编译MEX文件并运行修改后的版本,而无需重新启动MATLAB 。在莫哈韦沙漠下,这不再可能。 例如,使用以下简单的MEX文件(get_data_pointer.c): #include "mex.h" void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] ) { plhs[0] = mxCreateNumericMatrix(1, 1, mxUINT64_CLASS, mxREAL); *(uint64_t*)mxGetData(plhs[0]) = (uint64_t)mxGetData(prhs[0]); } 我们可以创建MEX文件并将其加载到内存中 mex get_data_pointer.c get_data_pointer(0) 为了清除它, clear mex [~,mexfiles] = inmem version -modules inmem确实返回了一个空单元格数组,指示未在内存中加载任何MEX文件,但是version -modules(未记录,根据此答案)仍显示/Users/cris/matlab/get_data_pointer.mexmaci64在其输出中。更改MEX文件的源代码并重新编译表明,确实从未重新加载MEX文件,旧版本仍在运行,直到有人退出MATLAB。 我在macOS Mojave的MATLAB R2017a上看到了这一点。在High Sierra下使用相同的MATLAB版本从来没有问题。 如何强制MATLAB在不重新启动的情况下卸载MEX文件?
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.