How to do array operation With simulink blocks ?
古いコメントを表示
I was designed below code with State flow. But I unable to do with the Simulink blocks.
please let me know, how to with the Simulink.
uint8 sampleFunction(uint8 *A, uint8 *B)
{
for(i=0;i<n;i++)
{
Temp = 0;
if(A[i] == B[i])
{
Temp = A[i] + B[i];
}
}
return Temp;
}
- > How we can take dynamic array ?
採用された回答
その他の回答 (1 件)
Nick Sarnie
2019 年 6 月 5 日
編集済み: Nick Sarnie
2019 年 6 月 5 日
0 投票
Hi Sasidhar,
It looks like that loop is adding two matricies. The "Add" or "Sum" block can do this:
If the matrix size is constant once the simulation has started, you can simply set the dimensions in the block parameters. To make it easier, consider using Simulink.Parameters for the dimensions instead.
If the matrix size will change between simulation steps, you can use variable size signals.
Thanks,
Nick
2 件のコメント
Sasidhar Duggireddy
2019 年 6 月 6 日
Nick Sarnie
2019 年 6 月 6 日
Hi Sasidhar,
Can you provide an example of this operation?
Thanks,
Nick
カテゴリ
ヘルプ センター および File Exchange で General Applications についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
