Running Satellite Communications Toolbox with Python API
古いコメントを表示
I have 4 scripts, 2 in python and 2 in matlab, that I use to create operational schedules for a satellite. I am relatively new to coding, and have made things messy (I have to run all 4 in a specific order to obtain my desired output of a .csv file containing the schedule). In an effort to make things more efficeint, I am trying to use the MATLAB Python API to combine all 4 into 1 python file. When I run the following,
import matlab.engine
eng = matlab.engine.start_matlab()
eng.mainTwo(nargout=0)
I get the follwoing error: (it should be noted 'mainTwo.m' is the first of the four scripts I run, bad naming I know)
Error using satelliteScenario/groundStation
Invalid default value for property 'ColorConverter' in class 'matlabshared.satellitescenario.ScenarioGraphic':
Error defining property 'ConvertedColor' of class 'matlabshared.satellitescenario.internal.ColorConverter'. Class named 'matlab.graphics.datatype.RGBColor' is undefined or does not support property validation.
Error in mainTwo (line 39)
UGA = groundStation(sc, lat(84), long(84), 'Name', ...
Traceback (most recent call last):
File "c:/Users/Supreme/Desktop/STKIntegration/Repository/matlabMociScheduler/combined.py", line 3, in <module>
eng.mainTwo(nargout=0)
File "C:\Users\Supreme\AppData\Local\Programs\Python\Python38\lib\site-packages\matlab\engine\matlabengine.py", line 70, in __call__
return FutureResult(self._engine(), future, nargs, _stdout,
File "C:\Users\Supreme\AppData\Local\Programs\Python\Python38\lib\site-packages\matlab\engine\futureresult.py", line 67, in result
return self.__future.result(timeout)
File "C:\Users\Supreme\AppData\Local\Programs\Python\Python38\lib\site-packages\matlab\engine\fevalfuture.py", line 82, in result
self._result = pythonengine.getFEvalResult(self._future,self._nargout, None, out=self._out, err=self._err)
matlab.engine.MatlabExecutionError:
File C:\Program Files\MATLAB\toolbox\shared\orbit\@satelliteScenario\groundStation.p,
line 0, in groundStation
File C:\Users\Supreme\Desktop\STKIntegration\Repository\matlabMociScheduler\mainTwo.m, line 39, in mainTwo
Invalid default value for property 'ColorConverter' in class 'matlabshared.satellitescenario.ScenarioGraphic':
Error defining property 'ConvertedColor' of class 'matlabshared.satellitescenario.internal.ColorConverter'. Class named 'matlab.graphics.datatype.RGBColor' is undefined or does not support property validation.
This is the line in question, line 39:
UGA = groundStation(sc, lat(84), long(84), 'Name', ...
name, "MinElevationAngle", minElevationAngle);
I have not seen anyone else using the Python API to run scipts using the Satellite Communications Toolbox, so I really have no reference when trouble shooting. I assume this is because the toolbox is relatively new? It should also be noted that 'mainTwo.m' runs with no errors when ran inside matlab, but obviously when ran with the API is produces an error when creating the ground station object. Any thoughts?
3 件のコメント
Yongjian Feng
2021 年 7 月 15 日
Seems like you want to call all four scripts from python.
How about calling all scripts from matlab?
Ryan Hughes
2021 年 7 月 15 日
編集済み: Ryan Hughes
2021 年 7 月 15 日
William Hunter
2021 年 10 月 14 日
Any progress on this issue? I can cause the same error with this very simple example:
parfor idx = 1:1
sc = satelliteScenario();
gs = sc.groundStation();
end
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Call Python from MATLAB についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!