フィルターのクリア

How to observe the result of an unbounded array in simulink?

23 ビュー (過去 30 日間)
S.Lau
S.Lau 2024 年 1 月 11 日
コメント済み: S.Lau 2024 年 1 月 15 日
Hello there, I am a new user of both simulink and matlab. I am doing some experiment for my capstone project, but I encountered an exception in simulink where I created a matlab function and want to observed the results. The matlab function should return some matrices but when I clicked "Run", the compiler throws an exception like this:
A signal of unbounded array type is not supported on 'Input Port 3' of block 'test_simulink_model/Scope'. For a list of supported data types, see the block documentation page.
However, I dont understand why is this happening and how to solve this. Could I have your advice?
  2 件のコメント
madhan ravi
madhan ravi 2024 年 1 月 11 日
Show the MATLAB Function code
S.Lau
S.Lau 2024 年 1 月 11 日
Hi, thanks for your reply. I am playing around with the code like this:
function result = test_function(frequency, fft_points)
result = 0:frequency/fft_points:((frequency/2)-(frequency/fft_points));
end
This will throws the exception as I described. Should I use something elses in the simulink if I want to observe the result?

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

採用された回答

Fangjun Jiang
Fangjun Jiang 2024 年 1 月 11 日
編集済み: Fangjun Jiang 2024 年 1 月 11 日
Depending on the value of frequency and fft_points, the length of "result" could vary dramatically, thus "unbounded".
In Simulink, the size of most variables is fixed, like always 5 or always [3,4]. There could be variable size data but the maximum size has to be specified. For example, specify the max size of "result" as 100. During simulation running, the actual size of "result" could be 50 or 60, as long as it is <=100.
  4 件のコメント
madhan ravi
madhan ravi 2024 年 1 月 11 日
:)
S.Lau
S.Lau 2024 年 1 月 15 日
Thank you for the advice! It did solve one of the problem of my test model.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by