WriteExcelValueToDD

一. Description

此脚本主要用于将DD文件中的变量值更新为Excel中的数据。

二. Background

基于Targetlink进行MBD开发时,用Excel管理DD文件中的Table变量值。(一维,二维Look-up table均可)。
Note:当更新Look-up table一维变量时,需要在Excel中,先将列转置为行。例如,下图中电压更新到DD中,将呈现为
[2.837,3.29,3.384,3.447,3.504,3.544,3.581,3.612,3.642,3.676,3.722,3.778,3.84,3.887,3.924,3.973,4.031,4.064,4.075,4.096,4.19]
Voltage-Axis

三. Value in Excel

以如下Excel为例
OCV-SOC Table

四. Code

%The script is used to change the Values of variable with the data in xlsx file

filename = 'C:/Work/Model/TimeSolve/Table.xlsx'; %Set the xlsx file location here
sheet = 2;  %Sheet number set
xlRange = 'B3:D23'; %Range select
subsetA = xlsread(filename,sheet,xlRange);
dsdd('Open','Table.dd'); %Open the DD file to be modified
dsdd('Set','/Pool/Variables/batlib/lut/OCV-SOC','Value',subsetA);

五. Result

懒得截图了🤣

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值