I have encountered a problem. I have to use MATLAB with linux. I need to parse data from MATLAB to Linux and vice versa.
For exammple
This all is writtein in
basic.sh
this basic.sh has to be opened in MATLAB
s=3 # is defined is MATLAB
##########################
for (( p=1 ; p<5; p++ )) # from here starts the loop in Linux
do # is a command from Linux
echo "$p" # is a command from Linux
add= $p+s # should calulate in linux , is a command from Linux
add=add/5 # should do in MATLAB
done
#########################
add # should OUTPUT the value of add as there is no semicolumn in MATLAB
Kindly suggest me a possible way for such a small example the rest I will expand it myself.
best regards
Well, you can call Matlab from a terminal, and run a single command:
in which
<YOUR_COMMAND>
can be an m-script/function. The output of this can be redirected into shellscripts,(your script should be capable of handling pipes), or this entire command can be embedded in shell scripts,
You can of course also resort to using files as memory. Matlab part:
Shell script:
Advantage of this is that there is a strict separation between Matlab and shell script, and only one m-file will suffice.
Of course, whichever way you choose -- why would you want to do this in the first place? Matlab can do most of what bash is capable of, and is also platform independent (so if you switch to MS Windows, it all still works)...so can you clarify this a bit?