the error of 'Matlab can only run a file with a valid name'

560 ビュー (過去 30 日間)
sourena
sourena 2022 年 12 月 2 日
コメント済み: sourena 2022 年 12 月 2 日
Hello;
I got the error of 'Matlab can only run a file with a valid name', though everything was alright and the name of my file in my
device is synchronized with the name of the file, which is running in Matlab, and it still gives me the same error, what should I do?
Thank you so much.

回答 (2 件)

Walter Roberson
Walter Roberson 2022 年 12 月 2 日
You have used the green Run button to try to execute code that is stored in a file that is not named like a valid MATLAB identifier. For example if you had code inside a file named ArtProject (3).m then you would be given that error when you tried to use the Run button to run the code.
Note:
There is a problem going around that has to do with relatively recent Linux systems and /tmp being mounted on a tempfs device, and is related to trying ot use livescript or trying to run regular .m by "section". At the moment, I would not rule out the possibility that it might lead to that error message... but I don't think it is likely, the error tends to show up other ways.

Hiro Yoshino
Hiro Yoshino 2022 年 12 月 2 日
Please make sure you have that file on the PATH or in the current working directory.
In the case the file exist somewhere else (not in the current working directory), you need to add the path to the file to MATLAB Path.
Here are the the list of commands to edit your MATLAB Path.
By the way, what is the "mt device"?
  3 件のコメント
Walter Roberson
Walter Roberson 2022 年 12 月 2 日
If the file is not on the path then you would get an error about unrecognized function, not an error about invalid file name. This is not a correct analysis of the problem.
sourena
sourena 2022 年 12 月 2 日
thank you so much @Walter Roberson

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeSearch Path についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by