How do I resolve this package subclass path error?
Mostrar comentarios más antiguos
Hi all,
In R2014a, I've subclassed a class within a package hierarchy, where B subclasses A:
subclasstest/
└── +mypkg
└── +mysubpkg
├── @A
│ └── A.m
└── @B
└── B.m
My commands are:
cd subclasstest;
addpath(genpath(pwd));
import mypkg.mysubpkg.A
which A % /Users/cjones/subclasstest/+mypkg/+mysubpkg/@A/A.m % mypkg.mysubpkg.A constructor
a = A(1); % a = A with properties: x: 1 y: []
import mypkg.mysubpkg.B
which B % /Users/cjones/subclasstest/+mypkg/+mysubpkg/@B/B.m % mypkg.mysubpkg.B constructor
b = B(1,2); % Expecting B with properties x:1 y:2
Error using mypkg.mysubpkg.B
The specified superclass 'A' contains a parse error, cannot be found on MATLAB's search path, or is
shadowed by another file with the same name.
However, when I use the classes out of the package, I don't get the error:
subclasstest2/
├── A.m
└── B.m
With:
clear all; clear import;
cd ../subclasstest2/
addpath(genpath(pwd));
which A % /Users/cjones/subclasstest2/A.m % A constructor
a = A(1); % a = A with properties: x: 1 y: []
which B % /Users/cjones/subclasstest2/B.m % B constructor
b = B(1,2); % B with properties x:1 y:2
What am I doing wrong in the package hierarchy that would cause this error? I've seen this error message in many other postings after a bit of Googling, but I'm not seeing a clear answer. These classes use the 'classdef'-style syntax. Thanks much.
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Software Development en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!