Pratul - 5 months ago 15

Linux Question

I am running MATLAB on Linux with limited storage space in my home directory (

`/home/$USER`

`matlab_crash_dump.XXXX`

Answer

You need to specify the `MATLAB_LOG_DIR`

environment variable. MATLAB will use this to store all crash dumps.

From a related MATLAB Central discussion:

If you have set the environment variable $MATLAB_LOG_DIR, that's where we'll write the crash dump file. Otherwise, look in $HOME on UNIX, or in $TEMP, $TMP, $WINDIR, and finally C:\ (in that order) on Windows. The file will be named "matlab_crash_dump.$pid" where $pid is the process ID of MATLAB.

You can either do this within your `.bashrc`

file

```
export MATLAB_LOG_DIR=/custom/dir
```

Or within MATLAB itself prior to running any commands (or within your `matlabrc`

file)

```
setenv('MATLAB_LOG_DIR', '/custom/dir')
```

If you need to test this, the following simple mex file will cause a crash resulting in a crash dump file.

```
#include "mex.h"
void mexFunction( int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[] )
{
/* Access beyond the length of prhs */
size_t x = mxGetM(prhs[6]);
}
```

Source (Stackoverflow)

Comments