Hi, is it possible to open a file from a dialog box as if you were calling from the command window? Specifically, I need to load some variables to use in a GUI from an .m file in a specific directory. I'm going crazy!

3 commentaires

Adam
Adam le 5 Mar 2015
Variables are generally stored in a .mat file not a .m file. Is that what you mean?
Or do you mean you wish to open a .m file containing a script that will create some variables and you then want to use the variables that result from that?
I wish to open a .m file containing a script (a=1; b=2; ...); I declared all the variables in the file as global, so I can use it in other functions
Adam
Adam le 5 Mar 2015
Why don't you just have your script save the variables in a .mat file then you can load that wherever you want?

Connectez-vous pour commenter.

 Réponse acceptée

Sean de Wolski
Sean de Wolski le 5 Mar 2015
open foo.m
Or
edit foo.m

3 commentaires

using open command or edit command ins't helpful;infact in this way it opens the file in the editor and don't save all the variables in the workspace
Perhaps, you mean:
doc run
To run it (not "open" it).
the command run work nice. thank you!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by