Such issues are commonly caused by some environment variables being changed or cleared by MATLAB. I have very similar experience on Linux and Mac OS X, where this causes havoc when using system
or unix
.
In Unix-like systems, MATLAB is started from a shell script where all of this happens. So you can either incorporate missing variables there or in the .matlab7rc.sh
in your home directory (the latter is preserved when you upgrade MATLAB and it is much easier to use). I won't go into all the Unix details here.
An alternative workaround is to explicitly set those variables when you issue a system
command (e.g. system('export variable=value ; ...')
). It is quite a bit of work, but you can then use that MATLAB code on different computers with ease.
On Windows, I'm not completely sure about the exact location of the corresponding files (and whether MATLAB starts in quite a similar way as on Unix). But if they exist, you can probably find it in the MATLAB documentation.
Anyhow, the alternative fix should work here as well.
First you need to diagnose which system variables you need (likely a PATH
or anything that has a name related to Adams).
To do so in Windows, run set
from the Windows command prompt (cmd.exe
) and from within MATLAB. Whatever differs in the output is a possible suspect for your problem.
To inspect just a single variable, you can use the command echo %variablename%
.
I will assume that you have found that the suspect
environment variable is missing and should be set to value
.
The workaround fix is then to run your command in MATLAB as system('set suspect=value & ...')
where you replace ...
with your original command.
cd [whereverAdamsIs]
to the top of the batch file. – Pokechu22