Create array (size) based on a variable/constant (Simulink)
50 ビュー (過去 30 日間)
古いコメントを表示
Hey guys!
I have problems with simulink fixed sizes. I am trying to get a workaround for a problem.
So far I have a Matrix with is 200x2 in which I count all unique rows. The number of unique rows is the output of the function. This output is just a number.. e.g. 82. I want to use this output without the need of a matlab function block (bc it creates sizing errors coming from variable sizes and I want to work around this) to create a array with has the number of lines coming from the value of the unique output... so for example the output is 84. I want to create an array that is 84x2. The values of this array are not important.. can be random numbers or just 1 in every row.
I want to use this array for a (row) selector block to cut this 200x2 array into a new array which is Nx2 or from the example 84x2. Such that the numbers of rows are variable.
Is this possible? I could not find anything in the library. Any ideas? Or help would make my day because I am struggling with this whole variable size topic for over a week.
Cheers and best regards!
0 件のコメント
採用された回答
Bhargavi Maganuru
2020 年 4 月 27 日
Hi,
You can save the variable 'uni' to the workspace and try following steps to get variable size data out from the MATLAB function block as default is fixed size.
1. Select Edit Data in the MATLAB Function Block Editor.
2. Select the output signal for which you want to set the dimensions.
3. Enable the Variable Size check box and specify the size of the signal as [uni, 2]
Hope this helps!
2 件のコメント
VIGNESH BALAJI
2024 年 1 月 31 日
This did not wokr for me and I got this error - Size definition is referring to the value of 'uni' which is not a constant, or a constant initialized from workspace.
I used this as a variable name to set max limit for the signal going out of matlab function block
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Simulink Functions についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!