compiling Matlab files not clear

1 回表示 (過去 30 日間)
farzad
farzad 2020 年 3 月 11 日
コメント済み: farzad 2020 年 3 月 12 日
Hi All
I need to compile m files to standalone exe files : since I have multiple files containing functions that call each other in the Run, I would like to know if it's feasible.
I was following this link , but all the steps , specially the first step, has commented command !! meaning no commands !!
how do I proceed ?
will plotting and making histograms be possible in Exe compiled ?

採用された回答

Jakob B. Nielsen
Jakob B. Nielsen 2020 年 3 月 11 日
編集済み: Jakob B. Nielsen 2020 年 3 月 11 日
Hi farzad,
It is definitely possible to compile an m file to a standalone exe file, for example in the form of a GUI / app. When you open the application compiler, you can add your main file; the compiler will then automatically "run through" the script and fine all calls to your own functions - which will be added in the "files required for your application to run" menu in the app compiler window. A popular way to keep track of functions, is to have your main.m file and in the same directory a folder named subfunctions, in which you place all "downstream" functions that you call. Then simply start your main script with
addpath(genpath([pwd,'\SubFunctions\']))
and you're flying!
And yes, you can make plots and histograms in a compiled exe. Do keep in mind though, that the exe does only what the script tells it to, so if you have a (super simple example) code that does this:
x=[1 2 3 4 5 6 7 8 9 1 5 2 5 2 8];
histogram(x);
and you compile it to an app and run it, all you will get is a figure of that histogram, from that specific x. You need to make functions to get in 'new data' yourself, and if you want the possibility to both make histograms and regular plots, you also need to define that yourself :)
Happy scripting!
  3 件のコメント
Jakob B. Nielsen
Jakob B. Nielsen 2020 年 3 月 12 日
The best thing I can say is: Just do it! The worst thing that can happen is that you will have to make some changes in the code and compile it again :)
farzad
farzad 2020 年 3 月 12 日
ok I compiled, the exe file Won't open !
my code does not include the
addpath(genpath([pwd,'\SubFunctions\']))
but I actually first need to know what it does, but also I need that my code grab the current folder it is copied into to run. But still can't grasp why it is not opening

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by