How to read Simulink inputs from Matlab ?

8 ビュー (過去 30 日間)
ameen
ameen 2014 年 3 月 18 日
Hi all
I am trying to model some mathematical equation in Simulink where some of the inputs are constant number, some are varying with time and some are words like choices (yes or no)
i want to put all my variables in one file (for example .m file to be easily edited) then read it from Simulink.
i tried to write .m file then run it and print variables on the command window or the workspace then put a 'From workspace' block with the variable name in Simulink but i found an error because of 'Invalid matrix-format variable specified as workspace input'
any suggestions ??
Thanks

採用された回答

Jacob Halbrooks
Jacob Halbrooks 2014 年 3 月 18 日
編集済み: Jacob Halbrooks 2014 年 3 月 18 日
This error suggests that you are not using a data format that the block supports. See the Specifying the Workspace Data section of the block's reference page for more information. In addition, the block's dialog provides guidance on how to format matrix or structure data:
For matrix formats, each row of the matrix has a time stamp in the first column and a vector containing the corresponding data sample in the subsequent column(s).
For structure format, use the following kind of structure:
var.time=[TimeValues]
var.signals.values=[DataValues]
var.signals.dimensions=[DimValues]
If you do not actually need time-varying data, then consider using a Constant block instead, where you can enter your data's workspace variable name in the "Constant value" box.
  8 件のコメント
ameen
ameen 2014 年 3 月 20 日
Thank you very much for your help.
Pradeepth Sathyanathan
Pradeepth Sathyanathan 2021 年 4 月 29 日
Thanks you @Jacob Halbrooks

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by