Error in using variable from MATLAB workspace to Simulink?
古いコメントを表示
In my case I have one model file of Simulink. So when for the first time I run the model and I send one signal which I named as "Fs" in the "To Workspace" block. Then I use this "Fs" from the matlab workspace to calculate 'Rate of change of this Frequency signal' using matlab script. I have named the rate of change of frequency as variable "avg_rocof". Now I wanted to use this "avg_rocof" variable in my Simulink model using "FromWorkspace" block. But when I run the model I get the following above error
" Invalid matrix variable specified as workspace input in 'IEEE_14_Bus_System_SM_FFR/From Workspace'. The matrix data must be a real, double, have two dimensions, and at least two columns. The first column must contain time values and the remaining columns the data values. Matrix values cannot be Inf or NaN.
Anyone please assist in this problem?
採用された回答
その他の回答 (1 件)
Fangjun Jiang
2023 年 1 月 5 日
編集済み: Walter Roberson
2023 年 1 月 5 日
0 投票
The error message has explained the problem. Maybe you are not familar with the usage. Double click the "From Workspace" block, click Help to open the document. There should be some example models. You can look into the example models to figure out the proper format for importing your "avg_rocof" data.
Basically, if avg_rocof=rand(10,1), a column vector, then you need to construct a column time vector, e.g. t=(0:0.1:0.9)'
then the data for the "From Workspace" block should be [t;avg_rocof]
3 件のコメント
Taimoor Khan Mehmand
2023 年 1 月 5 日
編集済み: Walter Roberson
2023 年 1 月 5 日
Fangjun Jiang
2023 年 1 月 5 日
avg_rocof is a scalar value, not a vector?? 'Rate of change of this Frequency signal' sounds like a time-varying signal, not a single value.
But, if you are just take the average value, like the name indicates, then you can use a Constant block, not the "From Workspace" block. Specify the Constant value as avg_rocof.
Taimoor Khan Mehmand
2023 年 1 月 7 日
カテゴリ
ヘルプ センター および File Exchange で Get Started with DSP System Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!