本页面提供的是上一版软件的文档。当前版本中已删除对应的英文页面。
canHWInfo
(不推荐)有关可用 CAN 设备的信息
不推荐使用 canHWInfo
,它将在以后的版本中删除。请改用 canChannelList
。请参阅兼容性注意事项。
说明
示例
检测 CAN 设备
检测可用的 CAN 设备并调查设备通道。
hw = canHWInfo
hw = CAN Devices Detected Vendor | Device | Channel | Serial Number | Constructor... ------------|----------------------------|---------|---------------|--------------- MathWorks | Virtual 1 | 1 | 0 |canChannel(... MathWorks | Virtual 1 | 2 | 0 |canChannel(... Kvaser | Virtual 1 | 1 | 0 |canChannel(... Kvaser | Virtual 1 | 2 | 0 |canChannel(... NI | Virtual (CAN256) | 1 | 0 |canChannel(... NI | Virtual (CAN257) | 2 | 0 |canChannel(... NI | Series 847X Sync USB (CAN0)| 1 | 12345C |canChannel(... NI | 9862 CAN/HS (CAN1) | 1 | 12345A |canChannel(... Vector | Virtual 1 | 1 | 0 |canChannel(... Vector | Virtual 1 | 2 | 0 |canChannel(... PEAK-System | PCAN-USB Pro (PCAN_USBBUS1)| 1 | 0 |canChannel(... PEAK-System | PCAN-USB Pro (PCAN_USBBUS2)| 2 | 0 |canChannel(...
查看 Vector 属性以了解其 VendorDriverVersion
。
v = hw.VendorInfo(4)
v = VendorInfo with properties: VendorName: 'Vector' VendorDriverDescription: 'XL Driver Library' VendorDriverVersion: '9000022' ChannelInfo: [1×2 can.vector.ChannelInfo]
查看第一个 Vector 通道信息。
c1 = hw.VendorInfo(4).ChannelInfo(1)
c1 = ChannelInfo with properties: Device: 'Virtual 1' DeviceChannelIndex: 1 DeviceSerialNumber: 0 ObjectConstructor: 'canChannel('Vector','Virtual 1',1)'
输出参数
hw
— 检测到的 CAN 设备
can.HardwareInfo 对象
检测到的 CAN 设备,以 can.HardwareInfo 对象形式返回。您可以对输出对象 VendorInfo
属性进行索引,从而以编程方式访问供应商和通道信息。
版本历史记录
在 R2009a 中推出R2023b: canHWInfo
生成错误
canHWInfo
函数生成一个错误。您必须更新代码以改用 canChannelList
。
R2023a: canHWInfo
将来删除的警告
canHWInfo
函数警告,说明它将在以后的版本中删除。
您应更新您的代码以改用 canChannelList
。下表显示如何转换几个常见任务的代码。
任务 | 使用 canHWInfo 对象 | 使用 canChannelList 表 |
---|---|---|
获取 CAN 设备信息 | infoObj = canHWInfo | listTable = canChannelList |
获取供应商名称 | vendorName = ... infoObj.VendorInfo(1).VendorName | vendorName = listTable.Vendor(1) |
获取设备名称 | deviceNameInfo = ... infoObj.VendorInfo(1).ChannelInfo(1).Device | deviceName = listTable.Device(1) |
获取设备模型 | deviceModel = ... infoObj.VendorInfo(1).ChannelInfo(1).DeviceType | deviceModel = listTable.DeviceModel(1) |
获取通道编号 | channelNumber = ... infoObj.VendorInfo(1).ChannelInfo(1).DeviceChannelIndex | channelNumber = listTable.Channel(1) |
获取序列号 | serialNumber = ... infoObj.VendorInfo(1).ChannelInfo(1).DeviceSerialNumber | serialNumber = listTable.SerialNumber(1) |
MATLAB 命令
您点击的链接对应于以下 MATLAB 命令:
请在 MATLAB 命令行窗口中直接输入以执行命令。Web 浏览器不支持 MATLAB 命令。
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- 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)