Python language in Matlab "No appropriate method, property, or field"
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Davide
am 1 Mär. 2016
Kommentiert: Davide
am 2 Mär. 2016
In the Python Shell the following command (used to pilot the Digsilent Powerfactory software) works fine: app.GetFromStudyCase("ComLdf"). However, I am not able to identify a suitable translation for this command within the Matlab environment. For example, using the syntax app.GetFromStudyCase('ComLdf'), Matlab gives the following error: "No appropriate method, property, or field 'GetFromStudyCase' for class 'py.powerfactory.Application'."
Any suggestion?
Thank you in advance for your support.
0 Kommentare
Akzeptierte Antwort
Robert Snoeberger
am 2 Mär. 2016
What type of attribute is 'GetFromStudyCase'? Is it an instance method, static method, etc? One way to check is to look at the display. What does the following command display?
>> py.getattr(app, 'GetFromStudyCase')
Here are a few workarounds to try:
1. Use eval to call the method.
py.eval('app.GetFromStudyCase("ComLdf")', struct('app', app))
2. Use feval to invoke the instance method object.
methodObj = py.getattr(app, 'GetFromStudyCase');
feval(methodObj, 'ComLdf') % starting in R2015a, the syntax methodObj('ComLdf') should work
3. Use py.operator.methodcaller to call the method.
f = py.operator.methodcaller('GetFromStudyCase', 'ComLdf');
feval(f, app) % starting in R2015a, the syntax f(app) should work
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Call Python from MATLAB 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!