2

I have a question about Matlab compiler, which I am very new to.

I am trying to compile a large Matlab program to a standalone unix application. It has a number of supporting directories (filled with .m files) which run algorithms on input data. One of the key uses of this program is in allowing users to add their own .m files with their own algorithms for the program to run.

I am able to compile the project and run it as a standalone without issue. But the user can no longer access and add supporting files once it had been compiled.

Has anyone ever come across this before and have any suggestions for dealing with it? I understand that the .m files need to be compiled to .exe and such, but I was hoping Matlab might have a workaround for keeping supporting files in their original state.

  • [Compiled Applications Do Not Process MATLAB Files at Runtime](http://www.mathworks.com/help/compiler/writing-deployable-matlab-code.html#bsf4mga) – Amro Sep 11 '13 at 05:22
  • I'm afraid this is done on purpose. The reason being that by offering to execute arbitrary matlab-code, you could in principle build an application offering all matlab-functions, that's freely distributable. Which is not really in mathwork's interest :) Similar constraints are e.g. also within the license for matlab-based web-applications... – sebastian Sep 11 '13 at 06:47
  • similar questions: [Running an .m file from a MATLAB-compiled function](http://stackoverflow.com/q/7409606), [How to run external .m code in a MATLAB compiled application?](http://stackoverflow.com/q/10882259) – Amro Sep 13 '13 at 08:05

1 Answers1

2

This behaviour is by design, and you can't get round it - in fact it's not only technically impossible, it's against the license agreement:

5.2.3. Licensee's Application may not provide scripting capability similar to the capabilities of any of the Programs or provide functionality or behavior similar to that of the MATLAB command line.

Imagine if you created an application that simply accepted user input and passed it into the function eval. If you compiled it, you would then be able to essentially give away free copies of the whole of MATLAB to anyone.

Sam Roberts
  • 23,951
  • 1
  • 40
  • 64
  • hmm, never knew it was against the license.. I suggested doing just that in one of my old answer to build a cloud-based distributed MATLAB server: http://stackoverflow.com/a/6564784/97160 – Amro Sep 13 '13 at 07:54
  • @Amro Yep, your suggestion there would be entirely against the license agreement - imagine if you connected that to the public web. However, see my (very late) comment on that question. – Sam Roberts Sep 13 '13 at 08:32
  • thanks for the info. I personally never needed computing power beyond that of the local machine, so this is not really an issue for me :) – Amro Sep 13 '13 at 08:54