parameter writerブロック​を用いてconsta​ntブロックのval​ueにint32型の​データを書き込めない

23 views (last 30 days)
和馬
和馬 on 8 Jan 2026 at 12:45
Commented: 和馬 on 9 Jan 2026 at 0:34
parameter writerブロックを用いてconstantブロックのvalueにint32型のデータを書き込めません。
以下のモデルのように、constantブロックで[10 20]をint32型で定義し、この値をparameter writerで他のConstantブロック("Constant_block")に書き込もうとすると、警告が出て実行されません。
これを解決する方法を教えてください。
  1 Comment
和馬
和馬 on 8 Jan 2026 at 13:05
追加コメントです。
int32型データだけでなく、single型データや複素数データの書き込みも出来ませんでした。
double型のデータ書き込みしか対応していないのでしょうか?

Sign in to comment.

Answers (1)

交感神経優位なあかべぇ
交感神経優位なあかべぇ on 8 Jan 2026 at 14:00
Constantブロックの定数値を[0 1]から、int32([0 1])に変更すれば、実行できると思います。
  2 Comments
和馬
和馬 on 9 Jan 2026 at 0:30
ありがとうございます。
int32([0 1])とすることで、実行できることを確認できました。
parameter writerを使用する場合、セット先の数値をキャストして使用する必要があるということでしょうか。
また、複素数データを取り扱う場合はどのような手立てがありますか?
和馬
和馬 on 9 Jan 2026 at 0:34
上記質問については取り下げます。
complex()関数によって複素数へのキャストも行えることを確認しました。

Sign in to comment.

Products


Release

R2025b

Community Treasure Hunt

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

Start Hunting!