MATLAB Answers

My code works when i open the main file directly, but dont work when i open the file from matlab!

1 view (last 30 days)
nicolas lima
nicolas lima on 6 May 2021
Answered: Cris LaPierre on 6 May 2021
Hey!
I'm having a problem with a code in matlab and I don't know what to do.
When I open my .mat file directly (by double-clicking) I can run it normally. When I open matlab and go to your directory it doesn't work.
The code in question calls a program in JAVA. This program has several dependency files that are located in the same directory as your .jar.
As I understand it, when I open matlab and then run the script through the directory, for some reason, .jar does not have access to its dependencies, even though those dependencies are inside the path when I check with "exist ('filename') ".
What do you think it can be?

Answers (1)

Cris LaPierre
Cris LaPierre on 6 May 2021
Perhaps you need to change the extension of your file? In MATLAB, .mat files are not executable scripts. They are binary files that save workspace variables. Perhaps you meant to create a script, which has a .m extension?

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by