Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab不调用Python类继承的方法_Python_Matlab_Inheritance_Python Can - Fatal编程技术网

Matlab不调用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

我正在使用Matlab从Python CAN包中调用Python CAN函数

Python中的代码运行良好,但从Matlab调用时却不行。问题似乎是Matlab正在从父类而不是子类调用send()方法。Matlab需要从子类调用send()方法

此链接显示了Matlab对Python支持的限制:

以下是我的python代码:

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库代码