I am a centos 5 user and I am running matlab R2011a. I don't think my question is version specific at all.
I am running a markov chain monte carlo (MCMC) simulation that compares real data to my simulated data. The MCMC front end calls a program that generates the simulated data. This simulated data is returned to the MCMC program itself and then a subtraction of the simulated data from the real data is performed. The MCMC front end does this about 10000 times during a single run, so speed of the program being called by the MCMC is essential. Usually the subroutine called by the MCMC program is written in fortran. I am not particularly fortran savvy, so I was exploring options of using a matlab executable instead. Matlab has the option to open a file and write results to it, but this is obviously a bad idea, as running a simulation, then opening a file, writing to it, then closing it, followed by opening it with my MCMC front end would impose a huge overhead on the entire process. FORTRAN specifies output variables that are returned immediately, so this makes for very fast interaction between the subroutine and the front end.
Is there a UNIX/Matlab user that could help me with this? I need to have a matlab command that ultimately writes results to the unix command space. Matlab has the unix command, which has a syntax of unix('command') but I need to pipe my matlab results out. The matlab command disp displays a variable. This is what I need.
So I can imagine code like this:
But this does not work, as I can't find a way to pipe the output of disp into the unix command. Can anyone lend a hand?