Matlab file MAC - Script Error

17 views (last 30 days)
Rajan
Rajan on 7 Feb 2023
Commented: Walter Roberson on 7 Feb 2023
For my work I have to upload a MATLAB script to this website. The script originally runs fine. When I then download the file once submitted and then run the script, the script won't work. It says the error is that the filename must only contain letters, numbers or underscores and that the file name isn't valid.
(I am using a MAC). Can anyone help me solve the issue ? It seems like when I upload the file to the website, it changes the file name by adding a (number) at the end of the original file name.

Answers (1)

Steven Lord
Steven Lord on 7 Feb 2023
Did you already have a copy of the file in the directory to which you downloaded? I'm not sure if Mac behaves the same way as Windows does, but I'd guess it probably does. Windows will append " (2)", " (3)", etc. to the file name if you try to download the same file multiple times. Neither spaces nor parentheses are allowed in the names of MATLAB program files.
So if you're trying to run myfunction.m that would work. If you then downloaded myfunction.m again (so its name is now "myfunction (1).m") you'll need to rename it.
  4 Comments
ihsvoaopk
ihsvoaopk on 7 Feb 2023
So, when my teacher downloads the file, the script should run smoothly straight away without having to rename the file or anything, since it will be their first time downloading the file ?
Walter Roberson
Walter Roberson on 7 Feb 2023
As long as the file name is a valid MATLAB identifier.

Sign in to comment.

Categories

Find more on Downloads in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!