Making dialog box parameters for MATLAB function blocks

1 回表示 (過去 30 日間)
Mike Vukovich
Mike Vukovich 2014 年 11 月 17 日
コメント済み: Mike Vukovich 2014 年 12 月 4 日
Hi everyone, I'm a beginner at creating my own Simulink blocks and I was wondering if anyone could help with this.
Anyway, I'm trying to implement a MATLAB function as a block in Simulink. The function has multiple inputs as is, but I'd like to change some of the inputs to parameters that can be changed via dialog box if possible.
So suppose the block represents a simple function (far simpler than the one I want to work on):
function [x, y] = fcn(u, v)
%#codegen
x = u + v;
y = u - v;
How can I turn y into a parameter that can be tuned via dialog box rather than an input?

採用された回答

Ryan Livingston
Ryan Livingston 2014 年 11 月 18 日
In the MATLAB Function Block editor you can click edit data. This brings up a dialog that lists all of the inputs and outputs. Select the input you want and change the "Scope" setting to "Parameter". More details here:
  1 件のコメント
Mike Vukovich
Mike Vukovich 2014 年 12 月 4 日
Thanks! That helped a lot :)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulink Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by