필터 지우기
필터 지우기

SimScape code to Matlab function.

조회 수: 15 (최근 30일)
Peter Balazovic
Peter Balazovic 2022년 10월 12일
댓글: Isaac 2024년 5월 8일
I am looking for an advice how to connect my Matlab function (m-scripts) with SimScape simulation?
Is it possible to connect Matlab m-script with SimScape code if so - how - any example?
Or other way to have that m-script (Matlab function) as Simulink wrapped (MATLAB Function Blocks)?

답변 (1개)

Dhruv
Dhruv 2023년 2월 20일
Yes, it is possible to connect MATLAB functions (m-scripts) with SimScape simulation. One way to do this is to use a MATLAB Function block in Simulink model. Following are the steps to connect MATLAB function with SimScape:
  • Create the MATLAB function which performs the calculation needed for SimScape model.
  • In Simulink, add a MATLAB Function block to the Simulink model by clicking on the "Library Browser" button, selecting the "Simulink" library, and then dragging a MATLAB Function block into the model.
  • From the MATLAB Function block go to the block parameters dialog and select the "MATLAB Function" option under the "Block Type" section. In the "MATLAB Function" section, specify the path to your MATLAB function in the "Function name" field.
  • In the "Inputs" and "Outputs" section specify the respective parameters
  • Connect the input ports of the MATLAB Function block to the inputs of the SimScape blocks that will be used as inputs to your MATLAB function. Similarly, connect the output ports of the SimScape blocks that will receive the outputs of your MATLAB function to the output ports of the MATLAB Function block
  • Save the Simulink model and run the simulation
  댓글 수: 1
Isaac
Isaac 2024년 5월 8일
Hello, I have the same issue, can you share photos of the steps you mentioned? I tried to followed them, but those options do not appear in my Matlab Function Block.
Thanks.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Foundation and Custom Domains에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by