Add_lineをforで繰り返し処理したい。

3 views (last 30 days)
YN
YN on 24 Jun 2022
Commented: Toshinobu Shintai on 24 Jun 2022
In1とOut1を、In2とOut2を•••というふうにブロックを、add_lineで自動結線をしていきたいです。具体的にはforを使ってnをインクリメントしていき、端子番号の指定をnでできるようにしたいです。何か方法はありますでしょうか。

Accepted Answer

Toshinobu Shintai
Toshinobu Shintai on 24 Jun 2022
例えば以下のように、増える数値を文字列に変えることができます。このようにして作成された文字をadd_lineの引数に指定し、実行させることができます。
for i = 1:10
text = "In" + num2str(i) + "/1";
disp(text);
end
In1/1 In2/1 In3/1 In4/1 In5/1 In6/1 In7/1 In8/1 In9/1 In10/1
  2 Comments
Toshinobu Shintai
Toshinobu Shintai on 24 Jun 2022
'と"の違いは、以下のリンク先を参考にしていただければと思います。

Sign in to comment.

More Answers (0)

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!