Calling a .m file based on user selection

2 ビュー (過去 30 日間)
Matt
Matt 2016 年 10 月 19 日
コメント済み: Matt 2016 年 10 月 21 日
Hi all,
I have a GUI with a dropdown menu that is populated by a number of .m files in a directory, in a folder in the program root folder. When the user makes a selection, it is stored as a variable, 'circ'.
I have been using the run command, to run this .m file, but I am wanting to compile the program, and have found (I think) that the run command/function is not compatible with compiling.
run(fullfile('D:\Dropbox\PROGRAM\Trx', circ))
How can I do this differently?
Ordinarily I would just call it e.g.
Trx1
But because I need it to be based on user selection I created a directory, and used the run function.
Thanks,
Matt

採用された回答

Walter Roberson
Walter Roberson 2016 年 10 月 19 日
Compiled code can only invoke pre-compiled files, not user selected .m at run-time. Compiled code does not have a MATLAB interpreter.
  1 件のコメント
Matt
Matt 2016 年 10 月 21 日
Thanks - based on this and some other recent questions I have revamped my program to save and load data from .mat files instead of .m files.
Now I no longer need to use the run command and my data handling is much better.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeFile Operations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by