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

3 次查看(过去 30 天)
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 中查找有关 Aerospace Applications 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by