MATLAB compiler and superiorto

3 Ansichten (letzte 30 Tage)
Matt J
Matt J am 10 Okt. 2012
I have a piece of MATLAB code that I'm trying to compile into a standalone. The uncompiled version works fine, but when I compile it and run from a DOS command window, I encounter an error
Unknown class 'SeparableLinearOp' used in builtin function 'SUPERIORTO'
The call to superiorto is in the constructor of a second, old-style class. The class SeparableLinearOp is not being used, so I didn't provide code for it. Because SeparableLinearOp is not being used, the M-code version doesn't care about its absence. Why does the compiled version care?

Akzeptierte Antwort

Matt J
Matt J am 16 Okt. 2012
After working with tech support, the problem seems to be resolved. Basically, if you call superiorto('ClassA','ClassB',...,'ClassZ'), then definitions for all those classes have to be in the CTF archive. However, as usual, the compilation process isn't always smart enough to know what to include in the archive and you have to force the inclusion of certain things with pragmas. This was the case for SeparableLinearOp, because it was never actually invoked. It just appeared within the list of string arguments to SUPERIORTO.
However, a more convenient solution than adding pragmas was to dynamically detect which classes were present and adjust the superiorto argument list accordingly:
inferiorClasses={'ClassA','ClassB',...,'ClassZ'};
oldclasses=cellfun(@(c) exist(['@' c],'dir'), inferiorClasses );
newclasses=cellfun(@(c) exist(c,'file'), inferiorClasses );
superiorto(inferiorClasses{oldclasses|newclasses});
It's a bit of a shame, of course, that SUPERIORTO can't just ignore undefined classes. It also would have saved some headache if exist(...,'class') worked on old style classes as well as new ones.

Weitere Antworten (1)

Image Analyst
Image Analyst am 10 Okt. 2012
Are you sure it's not being used. Run this:
and really check for it. It might be buried in there unbeknownst to you through a call to a function you don't suspect is using it. Generally you can' compile in modules that have extensive user interfaces with them - for example imtool. When you compile, the excluded log will list files that cannot be included in the compiled versions.
  6 Kommentare
Matt J
Matt J am 11 Okt. 2012
You agree with point (2) but not the first bullet point of part (1)? Why would the compiled version need it if the uncompiled version does not?
Image Analyst
Image Analyst am 11 Okt. 2012
I didn't disagree with point 1, I just didn't have any comment on it. I have no explanation for what you're seeing. As you know, it makes little sense.

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Standalone Applications finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by