As part of a txt file with instructions on how to run, I use a folder name as a parameter as shown below. However, LINUX does not recognize it. What could I be doing wrong?

foldername = "SOPHIE_TRANS"
matlab -nodesktop -nosplash -r "CellSort($foldername);quit"
  • add set -x before your matlab command to make sure your script or command is doing what you thing it's doing.
    – DopeGhoti
    Jun 8, 2018 at 17:46
  • 5
    The code contains a typo (spaces around =).
    – Kusalananda
    Jun 8, 2018 at 18:20

1 Answer 1


You are not setting a valid variable. You cannot have a space between the variable name, the equals, nor the variable value.

Try like this:

matlab -nodesktop -nosplash -r "CellSort($foldername);quit"

Not the answer you're looking for? Browse other questions tagged or ask your own question.