unable to pass command line arguments to matlab script

I'm not using a function here. I just want to pass an argument to matlab script from command line.
Here is the command I'm using,
Matlab 2020a -batch "x=100691;run <matlab>.m"
x is the variable I want to set from command line.
I end getting this error,
Unrecognized function or variable 'x'.

3 个评论

What's the rest of the line intended to be doing??? Specifically, what's <matlab>.m? It's going to pass the literal string you type.
What's the script look like?
it was a complex code and confidential, so cannot put it here.
I could resolve the issue. I had
clear all;
in the beginning of the program and I removed it and its working now.
I would say this is a lesson in using functions to do actual work. That way you have a documented interface without such issues.

请先登录,再进行评论。

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Data Type Identification 的更多信息

产品

版本

R2020a

提问:

2023-4-11

评论:

Rik
2023-4-12

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by