Al momento, stai seguendo questa domanda
- Vedrai gli aggiornamenti nel tuofeed del contenuto seguito.
- Potresti ricevere delle e-mail a seconda delle tuepreferenze per le comunicazioni.
Method is not defined or is removed from MATLAB search path
14 Commenti
- there's never any need to cd into anything, thus the current folder shouldn't change
- you shouldn't rely on the current folder, instead the class folder should be on the path
- When doCoolStuff.m is inside the ourTools/@doCoolStuff folder (method folder), it gets overshadowed by the one in theirTools, even though theirTools is lower on the path than ourTools.
- When doCoolStuff.m is inside the ourTools/doCoolStuff folder (regular folder on path), both the class and method files are found using which(), but the error mentioned in my post above occurs, indicating that the associated methods were not found when trying to actually call the function.
- I've been using the same class, methods, and matlab path for months with no issues. The only potential difference this time was that I was running another MATLAB instance in the background in the same working directory as the one in which I was seeing this problem
- Methods defined within MyClass.m are working just fine
- Matlab IS able to auto-complete the names of the class methods that it supposedly can't find. Ie, typing instance.myEx and hitting tab correctly auto-completes to instance.myExternalMethod
- Examining the path variable shows nothing amiss. The directory containing @MyClass is on the path, and there doesnt seem to be anything on the path that might be confounding things
- Performing which('MyClass') shows what I'd expect: \\server1\...\@MyClass\MyClass.m % MyClass constructor
- Performing which('myExternalMethod') shows: \\server1\...\@MyClass\MyClass.m % MyClass method (note: there is a method stub of myExternalMethod in MyClass.m)
- Since the which() call on the external method returned MyClass.m instead of @MyClass/myExternalMethod.m, I wanted to see what would happen if I commented out the function definition stub in MyClass.m. That is, MyClass.m contains the line "myExternalMethod(obj)", and I commented this out
- After that, the call to which('myExternalMethod') showed: \\server1\...\@MyClass\myExternalMethod.m as I might expect
- And now, suddenly, everything was working again. I could call instance.myExternalMethod() without throwing an error.
- I then un-commented the function stub, reverting the file to its original state, and everything was still working fine. So essentially the issue fixed itself somehow. All of the other external methods also started working (they had all been causing the same error).
- /parentFolder/myClass.m
- /parentFolder/@myClass/foo1.m
- /parentFolder/@myClass/myClass.m
- /parentFolder/@myClass/foo1.m
Risposte (0)
Vedere anche
Categorie
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Si è verificato un errore
Impossibile completare l'azione a causa delle modifiche apportate alla pagina. Ricarica la pagina per vedere lo stato aggiornato.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
Asia-Pacifico
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
