原代码:
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');