Run matlab, bash and python scripts
%matplotlib inline
import os
import subprocess as sp
import swe_plot
# simple commands can be run with a !
!ls
1A01P.csv 1A02P.csv 1A03P.csv aspread.m Driver.ipynb outfile1.txt special swe_plot.py swe_plot.pyc 1A01P.mat 1A02P.mat 1A03P.mat aspstnflags.mat nohup.out SnowPlay.ipynb store swe_plot.py~ swe.png
# more complicated commands, say where you want to use a variable file name, can be run with os
newdirectory = 'matfiles'
os.mkdir(newdirectory)
!ls -F
1A01P.csv 1A02P.csv 1A03P.csv aspread.m Driver.ipynb nohup.out SnowPlay.ipynb store/ swe_plot.py~ swe.png 1A01P.mat 1A02P.mat 1A03P.mat aspstnflags.mat matfiles/ outfile1.txt special/ swe_plot.py swe_plot.pyc
# and calling scripts
sp.call(["matlab","-nodesktop","-nodisplay","-r","aspread('1A01P.csv');exit"])
sp.call(["matlab","-nodesktop","-nodisplay","-r","aspread('1A02P.csv');exit"])
# maybe a prettier way of doing it
cmd = "matlab -nodesktop -nodisplay -r aspread('1A03P.csv');exit".split()
sp.call(cmd)
0
swe_plot.swe_plot()