Matlab不调用Python类继承的方法
我正在使用Matlab从Python CAN包中调用Python CAN函数 Python中的代码运行良好,但从Matlab调用时却不行。问题似乎是Matlab正在从父类而不是子类调用send()方法。Matlab需要从子类调用send()方法 此链接显示了Matlab对Python支持的限制: 以下是我的python代码:Matlab不调用Python类继承的方法,python,matlab,inheritance,python-can,Python,Matlab,Inheritance,Python Can,我正在使用Matlab从Python CAN包中调用Python CAN函数 Python中的代码运行良好,但从Matlab调用时却不行。问题似乎是Matlab正在从父类而不是子类调用send()方法。Matlab需要从子类调用send()方法 此链接显示了Matlab对Python支持的限制: 以下是我的python代码: import can bus = can.interface.Bus(bustype = "slcan", channel = 'COM6', bi
import can
bus = can.interface.Bus(bustype = "slcan", channel = 'COM6', bitrate = 250000)
print(type(bus))
dataToSend = [1, 2, 3, 4, 5, 6, 7, 8]
CAN_Msg = can.Message(arbitration_id = 0x1, is_extended_id = True, data = dataToSend)
bus.send(CAN_Msg)
输出:
<class 'can.interfaces.slcan.slcanBus'>
ans =
'py.can.interface.Bus'
Error using bus>send (line 171)
Python Error: NotImplementedError: Trying to write to a readonly bus?
输出:
<class 'can.interfaces.slcan.slcanBus'>
ans =
'py.can.interface.Bus'
Error using bus>send (line 171)
Python Error: NotImplementedError: Trying to write to a readonly bus?
有没有一种简单的方法可以在Matlab中使用python send()方法?欢迎任何调用python代码的想法,即使我必须创建一个新的python库或修改python库代码