From: Corbin Holland on
I want to allow users to create their own m-files and drop them in a local directory of their choice. I then want to be able to add the local directories path to the matlab path and load the m-files in this directory at runtime. This is possible when running inside of matlab using the addpath() method, but when I tried to execute it as a compiled app it won't let me if I try to add a path outside of its controlled mcr workspace.

So does anyone know of a way to make this happen in a compiled app..I would really like to have this functionality.

Thanks :)
From: ImageAnalyst on
Corbin Holland:
I sort of understand but sort of not.
Please explain how your users are going to be creating m-files in your
compiled app? Normally you do that only in the MATLAB development
environment, not in a compiled app.

There are a few tricks for compiling that aren't obvious and they
involve putting stuff into your startup.m file and setting your
environment variable MCR_CACHE_ROOT to . (just a single dot) so that
your code unpacks into the folder where it lives rather than some
strange temporary folder (which is the dumb default and will prevent
you from accessing your subfolders of your app). (This is Windows I'm
talking about.)
From: Steven Lord on

"Corbin Holland" <cholland.nospam(a)opticalsciences.com> wrote in message
news:hnm4il$mke$1(a)fred.mathworks.com...
>I want to allow users to create their own m-files and drop them in a local
>directory of their choice. I then want to be able to add the local
>directories path to the matlab path and load the m-files in this directory
>at runtime. This is possible when running inside of matlab using the
>addpath() method, but when I tried to execute it as a compiled app it won't
>let me if I try to add a path outside of its controlled mcr workspace.
>
> So does anyone know of a way to make this happen in a compiled app..I
> would really like to have this functionality.

No. A compiled application can only run M-files that were included at
compile-time.

http://www.mathworks.com/access/helpdesk/help/toolbox/compiler/bsfez67.html

--
Steve Lord
slord(a)mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ


From: Corbin Holland on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <8e73c95b-1498-4764-b15a-155eb34029c7(a)g26g2000yqn.googlegroups.com>...
> Corbin Holland:
> I sort of understand but sort of not.
> Please explain how your users are going to be creating m-files in your
> compiled app? Normally you do that only in the MATLAB development
> environment, not in a compiled app.
>
> There are a few tricks for compiling that aren't obvious and they
> involve putting stuff into your startup.m file and setting your
> environment variable MCR_CACHE_ROOT to . (just a single dot) so that
> your code unpacks into the folder where it lives rather than some
> strange temporary folder (which is the dumb default and will prevent
> you from accessing your subfolders of your app). (This is Windows I'm
> talking about.)

Thanks for your response and for the MCR_CACHE_ROOT trick. That may come in handy :)

So ok let me explain it a little better. I'm writing a data analysis package that is basically a graphical environment for reading in large data sets, processing data, and publishing graphs. Since all of my users are matlab proficient they want to be able to write their own data processing routines. So what I want to do is allow them to write an m-file that contains functions that are part of a well defined programming interface. So at initialization time I can go to the folder, read in all user defined m-files they have created and offer them as an option for processing data.

The solution that I use to date is to add the path of the directory containing their m-files to the matlab path and then read in all of the m-files, storing function handles to the various routines and saving them away for use later. When the user selects one of the user-defined analysis routines I simply find the corresponding function handle and pass it the data and return results which are plotted or passed to another data analysis routine. Like I said before all user-defined functions must adhere to a strict API so the inputs and outputs are well defined. So the beauty of this is the user can create their own data analysis function and just drop it in the directory and when they run my app it will just be there ready to use. Am I making any sense?
From: Corbin Holland on
ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <8e73c95b-1498-4764-b15a-155eb34029c7(a)g26g2000yqn.googlegroups.com>...
> Corbin Holland:
> I sort of understand but sort of not.
> Please explain how your users are going to be creating m-files in your
> compiled app? Normally you do that only in the MATLAB development
> environment, not in a compiled app.
>
> There are a few tricks for compiling that aren't obvious and they
> involve putting stuff into your startup.m file and setting your
> environment variable MCR_CACHE_ROOT to . (just a single dot) so that
> your code unpacks into the folder where it lives rather than some
> strange temporary folder (which is the dumb default and will prevent
> you from accessing your subfolders of your app). (This is Windows I'm
> talking about.)

Thanks for your response and for the MCR_CACHE_ROOT trick. That may come in handy :)

So ok let me explain it a little better. I'm writing a data analysis package that is basically a graphical environment for reading in large data sets, processing data, and publishing graphs. Since all of my users are matlab proficient they want to be able to write their own data processing routines. So what I want to do is allow them to write an m-file that contains functions that are part of a well defined programming interface. So at initialization time I can go to the folder, read in all user defined m-files they have created and offer them as an option for processing data.

The solution that I use to date is to add the path of the directory containing their m-files to the matlab path and then read in all of the m-files, storing function handles to the various routines and saving them away for use later. When the user selects one of the user-defined analysis routines I simply find the corresponding function handle and pass it the data and return results which are plotted or passed to another data analysis routine. Like I said before all user-defined functions must adhere to a strict API so the inputs and outputs are well defined. So the beauty of this is the user can create their own data analysis function and just drop it in the directory and when they run my app it will just be there ready to use. Am I making any sense?