Use of Arrays in Simulink
50 ビュー (過去 30 日間)
古いコメントを表示
hey,
I am reading a predefined array in a constant block in Simulink which then undergoes some simple logical operations like '<','>','and', etc. the output of which goes into an 'If' block.
This gives me an error as the input to the 'If' block has to be a single value and I seem to be inputting values of the length of my original array.
Is there some kind of a work around anyone could suggest?
Thanks, Dhruv
2 件のコメント
採用された回答
Friedrich
2013 年 8 月 13 日
編集済み: Friedrich
2013 年 8 月 14 日
Hi,
why not using a MATLAB function block with this code:
function y = fcn(u)
%#codegen
u(u<5) = 0;
y = u;
EDIT Way without MATLAB function block:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/172175/image.png)
%
5 件のコメント
Keerthi Shankar
2022 年 3 月 18 日
If I want to take particular element from the array how can I take it I am trying to implement interpolation taking two constant blocks as array... Could anyone help me with this
その他の回答 (3 件)
Dheeraj Kapur
2017 年 7 月 13 日
Hi, You can use a logic which I like to call the "moving" logic. You define the array in workspace, pass each of them into a decision box where if the value is less than 5 then replace it with 0; otherwise keep it same. Reconfigure the array on the other side and proceed as needed
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Event Functions についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!