writeCharacteristic
缩放指定的特征变量值并将其写入直接内存
说明
writeCharacteristic(
通过 XCP 通道对象 chanObj
,characteristic
,value
)chanObj
缩放并写入指定 characteristic
的值。此操作直接写入服务器模块上的内存。
示例
将值写入 XCP 通道特征变量
将值写入 XCP 特征变量并验证该值。
读取原始值。
a2lObj = xcpA2L('myA2Lfile.a2l'); chanObj = xcpChannel(a2lObj,'CAN','Vector','Virtual 1',1); connect(chanObj); charObj = a2lObj.CharacteristicInfo('torque_demand'); value = readCharacteristic(chanObj,charObj)'
100
写入一个新值。
newValue = 200; writeCharacteristic(chanObj,charObj,newValue');
再次读取该值以验证更改。
readCharacteristic(chanObj,charObj)'
200
输入参数
chanObj
— XCP 通道
通道对象
XCP 通道,指定为 XCP 通道对象。
示例: xcpChannel()
characteristic
— XCP 通道特征变量
特征变量对象 | 字符
XCP 通道特征变量,指定为字符向量或特征变量对象。
示例: 'torque_demand'
数据类型: char
value
— 向特征变量写入的值
特征变量值
向特征变量写入的值,指定为特征变量支持的类型。
版本历史记录
在 R2018a 中推出
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)