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

1 Ansicht (letzte 30 Tage)
TK
TK am 26 Apr. 2024
Beantwortet: Animesh am 29 Apr. 2024
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

Antworten (1)

Animesh
Animesh am 29 Apr. 2024
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:

Kategorien

Mehr zu Get Started with Aerospace Blockset finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by