How can I call satelliteS​cenarioVie​wer() by using Simulink (only)

조회 수: 1 (최근 30일)
TK
TK 2024년 4월 26일
답변: Animesh 2024년 4월 29일
I try the Aerospace Blockset from
mdl = "SpacecraftDynamicsBlockExampleModel";
open_system(mdl);
and Aerospace Toolbox from satelliteScenarioViewer
Finally, I see the combination of two systems from
openExample('aero_satcom/CustomSatelliteAttitudeAndGimbalSteeringExample')
Now, I want to call the function satelliteScenarioViewer in the Simulink and don't use MATLAB part (command window and script)
Is this method possible by using MATLAB system, MATLAB function block or any?
Thank you

답변 (1개)

Animesh
Animesh 2024년 4월 29일
It seems like you want to call an existing function, satelliteScenarioViewer, using Simulink. We can utilize the MATLAB function block for this purpose. In the code section of the MATLAB Function block, we can make a call to the required MATLAB function.
You can do something like this inside the MATLAB Function block:
function y = fcn(u)
viewer1 = satelliteScenarioViewer(scenario);
y = u;
Moreover, ensure that the MATLAB Function block can access the called function. If the .m file (containing the called function) is not in the current MATLAB path, you'll need to add its location to the path. This can be done by using the addpath function in MATLAB before running the Simulink model.
addpath('path_to_your_function');
You can refer to the following MathWorks documentation for more information on the MATLAB Function block:

카테고리

Help CenterFile Exchange에서 Get Started with Aerospace Blockset에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by