フィルターのクリア

Simulink model with inport-outport from .m file with sim()

1 回表示 (過去 30 日間)
Marcello Asciolla
Marcello Asciolla 2017 年 7 月 12 日
回答済み: Naty Shemer 2017 年 7 月 12 日
Hi, I want to run a Simulink model from .m file with sim() function. My Simulink file has inports and outports.
Let's suppose for example that "A" is the inport and "B" the outport. I tried this code:
clear all; close all; clc;
A=1;
B=sim('simulink_file');
But in the workspace I can see that B is 1D array [0 0.2 0.4 ... 10]. In other words that means that the output generated is the time of the simulation.
What is the correct way to give the inputs and set the outputs for the simulation with "sim()" function?

回答 (1 件)

Naty Shemer
Naty Shemer 2017 年 7 月 12 日
Hey,
Did you define the simulation outputs?
https://www.mathworks.com/help/simulink/slref/sim.html#outputarg_simOut
Open Output Argument tab to see how it is done..

カテゴリ

Help Center および File ExchangeManual Performance Optimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by