Matlab file MAC - Script Error

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.

Respuestas (1)

Steven Lord
Steven Lord el 7 de Feb. de 2023

1 voto

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 comentarios

ihsvoaopk
ihsvoaopk el 7 de Feb. de 2023
Yes - it exactly did this ' append " (2)", " (3)", etc. to the file name '. I already had a copy of the file in the directory to which I downloaded.
I did what you said - the file now says "worksheet.m". When I download it it says "worksheet (1).m". I then rename it and it is fine.
Question: I have to submit this as an assignment for homework. Am I right in assuming that when my teacher downloads the file, the script should run smoothly straight away without having to rename the file or anything ?
Walter Roberson
Walter Roberson el 7 de Feb. de 2023
You can assume that the file name you upload into will be the name that is used by the grading software.
ihsvoaopk
ihsvoaopk el 7 de Feb. de 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 el 7 de Feb. de 2023
As long as the file name is a valid MATLAB identifier.

Iniciar sesión para comentar.

Categorías

Más información sobre Downloads en Centro de ayuda y File Exchange.

Productos

Etiquetas

Preguntada:

el 7 de Feb. de 2023

Comentada:

el 7 de Feb. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by