Matlab system() environment variables

Matlab system() discards the shell environment variables. To set environment variables, set them in name-value pairs like:

if ispc
  system("echo %test_var%", test_var="hello")
else
  system("echo $test_var", test_var="hello")
end

Multiple environment variables can be set in a single command by adding more name-value pairs.

If there are known environment variables desired to set in the system command, do like:

system("make", CC=getenv("CC"))

To set multiple environment variables:

env = namedargs2cell(struct(CC="gcc", CXX="g++"));

system("make", env{:});