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")
  system("echo $test_var", test_var="hello")

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"))

If there is a struct of environment variables, do like:

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

envCell = namedargs2cell(envStruct);

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