matlab -batch always failed with: | Error: Invalid use of operator.
12 ビュー (過去 30 日間)
古いコメントを表示
Following Matlab's manual, I run Matlab with: matlab -batch ./hello.m or matlab -batch "./hello.m".
However, there is an error: | Error: Invalid use of operator.
The hello.m is just an oneline script: fprintf("hello\n");
Can you tell me what is the problem here?
Thanks!
0 件のコメント
採用された回答
Jan
2021 年 7 月 14 日
編集済み: Jan
2021 年 7 月 14 日
The string after the -batch argument must contain a Matlab command. "./hello.m" is not a Matlab command, because "./" is the elementwise division. You do not specify paths of Matlab functions, if you call them. The appended ".m" let Matlab assume that "hello" is a struct.
Try this instead:
matlab -batch "hello"
Remember to store the file hello.m in a folder, which is included in the Matlab path.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Get Started with MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!