Skip to content

Instantly share code, notes, and snippets.

@dbuscombe-usgs
Created July 26, 2013 02:24
Show Gist options
  • Save dbuscombe-usgs/6085573 to your computer and use it in GitHub Desktop.
Save dbuscombe-usgs/6085573 to your computer and use it in GitHub Desktop.
Write and execute a Matlab script without opening Matlab
filename=my_script.m;
cat > $filename << EOF
figure
plot(rand(1,10))
print -dtiff test.tif
close
EOF
chmod +x $filename
/usr/local/MATLAB/R2011b/bin/matlab -nodesktop -nosplash -r "my_script;quit;"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment