MATLAB与STK互联2:场景参数设置

前两篇文章,讲了怎么通过MATLAB建立场景,本节讲解怎么设置场景参数。
%代码如下
uiap = actxserver(‘STK11.application’);
root = uiap.Personality2;
root.NewScenario(‘mysce’);
%拾取当前场景,sc是以后当前场景的handle
sc = root.CurrentScenario;
%设置场景仿真时长
%仿真时间设置格式1。
sc.SetTimePeriod(‘Today’,’+24hr’)
%仿真时间设置格式2。建议使用格式2,后续建立对象会用到以下参数
sc.StartTime = ‘18 Aug 2020 04:00:00.000’;
sc.StopTime = ‘19 Aug 2020 04:00:00.000’;
sc.SetTimePeriod(sc.StartTime,sc.StopTime);
%设置完场景时间后,通过ExecuteCommand是动画重新设置
root.ExecuteCommand(‘Animate * Reset’)

%另外,如果是加载已建立的场景,则场景的起止时间是可读取的参数。
%代码如下
sc.Unload;%删除当前场景
%加载新的场景,使用自己本地已经建好的STK场景
root.Load(‘C:\Users\lty15\Documents\STK 11 (x64)\shuoming\anli.sc’);
sc = root.CurrentScenario;
sc_begintime = sc.StartTime;
sc_stoptime = sc.StopTime;

%设置场景中的单位
root.UnitPreferences.SetCurrentUnit(‘Distance’,‘km’);
root.UnitPreferences.SetCurrentUnit(‘Latitude’,‘deg’);
root.UnitPreferences.SetCurrentUnit(‘Longitude’,‘deg’);
%后续再有可设置的参数,将陆续补充。

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值