Sie verfolgen jetzt diese Frage
- Aktualisierungen können Sie in Ihrem Feed verfolgter Inhalte sehen.
- Je nach Ihren Kommunikationseinstellungen können Sie auch E-Mails erhalten.
Method is not defined or is removed from MATLAB search path
14 Kommentare
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
- 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
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
- 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.
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
- 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).
-
Verknüpfen
Direkter Link zu diesem Kommentar
- /parentFolder/myClass.m
- /parentFolder/@myClass/foo1.m
- /parentFolder/@myClass/myClass.m
- /parentFolder/@myClass/foo1.m
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
-
Verknüpfen
Direkter Link zu diesem Kommentar
Antworten (0)
Siehe auch
Kategorien
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Es ist ein Fehler aufgetreten
Da Änderungen an der Seite vorgenommen wurden, kann diese Aktion nicht abgeschlossen werden. Laden Sie die Seite neu, um sie im aktualisierten Zustand anzuzeigen.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- 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)
Asien-Pazifik
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)
