matlab中connect函数返回值,[转载]使用MATLAB方式进行connect编程时,错报语法错误的解决办法...

原代码:

clear;

clc

global mu;

global j2;

global req;

global k_J2;

global conID;

conID=stkdefaultconid; %execute this line of command before

using this M.file

scen_open = stkValidScen;

if scen_open == 1

rtn = questdlg('Close the current scenario?');

if ~strcmp(rtn,'Yes')

stkClose(conid)

return

else

stkUnload('','Satellite','Chief');

stkNewObj('*/','Satellite','sat1');

stkNewObj('*/','Satellite','sat2');

stkNewObj('*/','Satellite','sat3');

stkNewObj('*/','Satellite','sat4');

disp('Set scenario time period');

stkSetTimePeriod('16 Mar 2011 04:00:00.000','17 Mar 2011

04:00:00.000','GREGUTC');

stkSetEpoch('16 Mar 2011 04:00:00.000','GREGUTC');

stkSyncEpoch;

rtn=stkConnect(conID,'Animate','Scenario/SatelliteFormation','SetValues

"16 Mar 2011 04:00:00.000" 60 0.1');

rtn=stkConnect(conid,'Animate','Scenario/SatelliteFormation','Reset');

rtn =

stkConnect(conid,'SetBoundary','Scenario1/sun_rfi/AreaTarget/BoxTarget','Pattern

10 10 -80 10 -70 10 -60 10 -50 10 -40 -37 -40 -37 -50 -37 -60 -37

-70 -37 -80');

错误现象:

rtn=stkConnect(conID,'Animate','Scenario/SatelliteFormation','SetValues

"16 Mar 2011 04:00:00.000" 60 0.1');

这条指令运行时老报??? stkExec: error during

processing of Connect command, check command for valid syntax.

??? mexConnect: Unknown Exception!

Error in ==> stkExec at 45

lhs = mexConnect('stkExec', rhs0, rhs1);

Error in ==> stkConnect at 26

rtnData = stkExec(conId, [command ' ' path ' '

cmdParamString]);

Error in ==> Example4 at 37

rtn=stkConnect(conID,'Animate','Scenario/SatelliteFormation','SetValues

"16 Mar 2011 04:00:00.000" 60 0.1');这个错误时什么原因

麻烦您给看一下谢谢

解决方法:

remMachine = stkDefaultHost;

delete(get(0,'children'));

conid=stkOpen(remMachine);

scen_open = stkValidScen;

if scen_open == 1

rtn =

questdlg('Close the current scenario?');

if

~strcmp(rtn,'Yes')

stkClose(conid)

return

else

stkUnload('/*')

end

end

% create a new scenario

disp('Create a new scenario');

stkNewObj('/','Scenario','Matlab_Basic');

% set time period

disp('Set scenario time period');

stkSetTimePeriod('1 May 2000 00:00:00.0','2 May 2000

00:00:00.0','GREGUTC');

stkSetEpoch('1 May 2000 00:00:00.0','GREGUTC');

stkSyncEpoch;

rtn = stkConnect(conid,'Animate','Scenario/Matlab_Basic','SetValues

"1 May 2000 00:00:00.0" 60 0.1');

rtn =

stkConnect(conid,'Animate','Scenario/Matlab_Basic','Reset');

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值