Is it possible to put a compiled standalone executable on a datastick?

1 view (last 30 days)
Due to Covid-19, I am looking at ways of conducting psychological experiments that are usually done in a laboratory using MATLAB outside that context.
One way to do this would be to distribute an executable version of the MATLAB program to participants to run on their own computers at home.
I have looked at the compiler, but it seems only to be able to produce a package that has to be installed by the user. This seems to ask a lot of potential participants, int that they have to install it then run the program, then uninstall it. Is there any way to get all the required resources - DLLs etc.- into one folder so that it can be distributed and used conveniently, say on a datastick.
  4 Comments
Mohammad Sami
Mohammad Sami on 8 Sep 2020
If your existing code is mostly in form of functions, you may only have to redo the GUI and then wire in your callbacks.
John Culling
John Culling on 15 Sep 2020
Yes, that works. I have simply made the entire program a single callback.
But apparently I would need to have a dedicated web app server in order to deploy it.
John

Sign in to comment.

Accepted Answer

Rik
Rik on 7 Sep 2020
Edited: Rik on 7 Sep 2020
You have several options (feel free to add options if you have editing privileges, otherwise post a comment):
  • Compile to a standalone executable with Compiler. This will require installation of the runtime (or the presence of Matlab), wich you can include or allow users to download it separately.
  • Use Coder to generate C or C++ code, which you should then be able to compile to a stand-alone executable.
  • Compile your code to a web app, as suggested by Mohammad Sami.
  • Use GNU Octave instead of Matlab. This will very likely hurt performance (especially on Windows), require rewriting code to some extent (probably including re-compiling the DLLs you mentioned), and (depending on your taste) reduce how nice your GUI looks unless you recreate much on your own. Despite these downsides the GPL license means you can probably distribute the entire portable (zip) version along with your own code as a ready-made one-click solution.
  2 Comments
John Culling
John Culling on 8 Sep 2020
Thanks Rik,
Yes, so option 1 is the one I tried already and it does work, but places rather a burden on the experimental participant - some participants might be unhappy about being asked to install an application.
I looked into the Coder option, which sounded really good, but hit some problems because the Matlab code has to be changed for compatibility- I can see why arrays sizes need definition and could fix that, but I could not see why reading in audio files was not facilitated. At a pinch, I can write my own code to interpret a wav file, but I can see that sound() is not compatible either, which looks a lot more challenging. Do you know if it will work if I switch to audiopayer, or is audio functionality simply lacking here?
I'm still thinking about the web app idea.
Isn't Octave just for Linux?
Rik
Rik on 8 Sep 2020
I don't know about the audio alternatives. Generally the documentation will state at the bottom if it allows code generation.
And Octave works just fine of windows as well. Getting it to work on a Mac isn't hard, but you won't have a portable executable anymore. At least not that I know of. You are correct that bugs tend to stick around longer on windows.

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB Compiler in Help Center and File Exchange

Products


Release

R2019b

Community Treasure Hunt

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

Start Hunting!