Custom Classes in Standalone Applications?

6 vues (au cours des 30 derniers jours)
William Chapman
William Chapman le 21 Sep 2012
I have a very large custom class that holds & analyses interdependent variables inside of MATLAB. I'm now trying to compile this class into a standalone application by adding it as a dependent package to the new function that institutes instances of the custom class.
Simply adding the entire folder with the "additional files" option in deploytool doesn't see to be working. Additionally, simply adding a local copy of the package on the target computer doesn't seem to be working either ('err: file previously in path is no longer available').
Wondering if anyone had any experience with working with custom classes in the MRC.
Thanks!

Réponses (2)

Eric
Eric le 21 Sep 2012
What's MRC? Perhaps you mean MCR?
I've compiled some large GUIs that use a variety of my custom classes. My custom classes were defined in single M-files using the "classdef" functionality. I didn't have to do anything special when compiling these. Matlab found them as dependencies as needed. The classdef M-files were on the Matlab path.
It's not clear to me how you're trying to convert an object into an executable. It might be helpful to the community if you elaborate on that further. It might also be worthwhile to describe how your classes are defined. Are they defined with the "classdef" keyword (the newer format) or the older format that used private directories? If it's the former, is the class a handle class or not?
Good luck,
Eric
  2 commentaires
William Chapman
William Chapman le 26 Sep 2012
Sorry, yes I did intend to say MCR.
These classes are defined using private directories, and then defining the classtype inside of the private directories using the classdef keyword. The basic setup of our package is:
+TOOLBOX
- @MAINTYPE
MAINTYPE.m
method1.m
method2.m
- @SUBTYPE1
SUBTYPE1.m
method1.m
method2.m
- @SUBTYPE2
SUBTYPE1.m
method1.m
method2.m
In my functions that I want to distribute we will be using maintype and it's methods every time, and usually be using the subtypes (and their methods) as well. Currently in the functions to be distributed I indicate to import the classtype and then proceed to make use of them and their methods, which works fine for local runs. When dispatched though, even though I'm indicating to matlab to add that classdef folders (mcc -I TOOLBOXFOLDER), the package doesn't seem to be present on the deployed version of the functions
Eric
Eric le 26 Sep 2012
This is a different manner of creating objects than I'm used to. The only thing I can think to try is to include the methods within the classdef M-file. I wasn't aware that you could mix the older object-oriented methodology (private directories with separate M-files for each method) with the newer classdef() keyword.
Sorry I can't be of more help.
-Eric

Connectez-vous pour commenter.


Stefan
Stefan le 28 Fév 2013
Hello William,
did you manage to compile your program including your classes meanwhile? If yes, how did you do this?
I have the same problem and maybe I can do this like you did.
Greetings, Stefan

Catégories

En savoir plus sur Construct and Work with Object Arrays dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by