I want to run matlab using bash which requires the a command like matlab -nodesktop -nosplash -r functionmat(var1,var2) to be called. For example, I can run matlab -nodesktop -nosplash -r functionmat(5,4)  and if this is a valid input it works and creates some files and does whatever the mfile has inside it.But I want the variables to be inputs the user gets asked, thus it varies every run without the user needing to change the script. The user just enters different inputs when asked.This does not work (nothing happens):#!/bin/bashecho Please variables 1 and 2:read var1 var2matlab -nodesktop -nosplash -r functionmat($var1,$var2)Calling matlab like this does not work either (says this is an error since it probably is reading string type inputs when there supposed to be numbers):matlab -nodesktop -nosplash -r functionmat('$var1','$var2')This does not work either (nothings happens -- no files created):sect1=\sect2=functionmat(sect3=,sect4=)sect5=\matlab -nodesktop -nosplash -r $sect1$sect2$var1$sect3$var2$sect4$sect5Does any one no how to make it work?
How to call Matlab functions in bash with user input being operands
bash;shell script;matlab
Ok, I found a way to run the program  #!/bin/bash    echo Please enter variables 1 and 2:    read var1 var2    declare -i var1    declare -i var2    mystring=matlab -nodesktop -nosplash -r \functionmat($var1,$var2);exit\    eval $mystringThanks for all your help if you answered