1

I want to be able to pass in to a matlab script (or function) an argument which is a string. It works fine with integers but I cannot do it with Strings. Example: /usr/bin/matlab -nodisplay -r 'main('ana')'

I get: Undefined function or variable 'ana'.

I tried " as well and I get an error.

I have the same issue when main is a script and I write something like:

/usr/bin/matlab -nodisplay -r 'a='ana';main'.

Can you please tell me how to do this?

Thanks.

2 Answers 2

4

Try using " as delimiter for the command string:

/usr/bin/matlab -nodisplay -r "a='ana';main"
Sign up to request clarification or add additional context in comments.

Comments

1

Try to run: /usr/bin/matlab -r "main('blabla')"

1 Comment

Thank you! I realised it eventually!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.