在Octave中,如何用新的“串行端口”打开串行端口。命令语法
八度串行通信的最新文档解释了使用“序列上”命令打开端口而不是弃用的“序列”命令。
没有解释如何关闭串行端口。我用它成功打开端口并进行一些写作
s1=serialport('com5','Baudrate',57600)
num=write(s1,'help')
,但我不知道如何关闭端口。我使用了这个:
fclose(s1)
得到了这个错误响应,
error: file id must be a file object, std::string, or integer value
有人知道如何关闭串行端口吗?
The latest documentation for serial communication in Octave explains to use the "serialport" command to open the port instead of the deprecated "serial" command.
There is no explanation of how to close the serial port. I used this to successfully open the port and do some writing
s1=serialport('com5','Baudrate',57600)
num=write(s1,'help')
But I can't figure out how to close the port. I used this:
fclose(s1)
And got this error response
error: file id must be a file object, std::string, or integer value
Does anyone know how to close the serial port?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
八度函数试图在可能的情况下模仿Matlan函数,这也没有密切的函数。
要关闭串行端口,将变量设置为其他东西,如果在其他地方不使用它,它将关闭端口。
您也可以清除变量:
The octave functions attempt to mimic where possible the Matlan functions, which also does not have a close function.
To close the serial port, set the variable to something else, and if it is not used elsewhere, it will close the port.
You could also clear the variable: