Domanda

I have a really simple problem with matlab, but I cannot seem to find my error. I have a file mfile.m, which contains the lines:

x=32
disp(x)

I open matlab and run the file using f9, output shows 32 two times, which is correct.

I now try to run the exact same file form the command prompt (Win7):

matlab -nosplash -r mfile.m

Output: Undefined variable "mfile" or function "mfile.m". Matlab cannot find the file even though the command prompt and current workdir is the same as mfile.m is stored in. This has been bugging me for quite some time now, any suggestions on why I fail to launch from cmd?

È stato utile?

Soluzione

It seems that the -r option takes just the filename without an extension. Changing matlab -nosplash -r mfile.m into matlab -nosplash -r mfile made the trick.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top