Running a batch file MATLAB - DIANA TNO

423 views Asked by At

Currently, I'm working with a finite element software called DIANA, I've been always capable of running "simple" models with MATLAB executing a batch file. Nevertheless, now I'm starting to use more "complex" models (just more robust, with more elements), but the procedure is exactly the same to the one that I've been using before. The problem is that now I can't run the model from MATLAB, it apparently start to run it, but stops suddenly. I'm using the next commands:

dos('path\filename.bat')

or

system(fullfile(path,'filename.bat' ))

Both lines execute the .bat file. I thought that I had something wrong with the files, so I reviewed them but apparently there's nothing wrong with them. Then I just made double click on the .bat file, and the procedure runs without problems. Then I realized that the problem wasn't the files, it was the execution from MATLAB. Now that you know the context of the problem, can you giving me some advice in order to avoid that MATLAB "kills" the process internally?

The trace of execution showed in MATLAB:

diana: working directory is *CURRENT DIRECTORY NAME*
diana: input file is *FILENAME*.dat
diana: command file is *FILENAME*.dcf
diana: output file is *FILENAME*.out
diana: filos file is diana.ff
DIANA JOB 8028 finished 

The trace execution making directly double click in the batch file is the following:

enter image description here

In the remarked files showed in the previous figure, are contained the output of the model, while executing directly from MATLAB, those don't appear, because MATLAB finish the process before.

Thanks in advance for any answer!

Pd: I'm using a computer with the next characteristics: Windows7, 12 Gb RAM, OS 64bits, Processor Intel Xeon 2.53 GHz.

2

There are 2 answers

0
rozsasarpi On

Here is the solution provided by Diana support team:

It seems that MATLAB sets some environment symbols that limit the memory usage per thread.

When you start Diana from Matlab via a batch file that resets the symbols all works fine.

Such a batch file may look like:

rem === Diana Environment Setup ===
    call "C:\Program Files\Diana 10.0\dialogin.bat"

rem Unset the symbols added by MATLAB
    set KMP_STACKSIZE=
    set KMP_HANDLE_SIGNALS=
    set KMP_BLOCKTIME=

rem start the diana job
    diana test2
6
Jean-François Fabre On

What you are running is not strictly equivalent to a double click on the .bat file, specially because current directory is different, and if the batch file needs to access to auxiliary files (relative path), then the files won't be found.

Try adding this in your batch file as the first command (or right after echo off)

Cd /d %~dp0