How to define data array in simulink

Hello all,
I want to define the array in simulink which consist of 'n' elements in it.
Can I read and write the array elements individually? If yes. How.?
please tell me as early as possible.
Thanks and Regards,
Rahut Patil.

2 件のコメント

madhan ravi
madhan ravi 2019 年 3 月 28 日
Use constant block, what do you mean by read and write the array individually?
rahut patil
rahut patil 2019 年 3 月 28 日
how can I use the conststant block?
Write : I will write the values of array elements in running mode.
read :I will read the values of array elements in running mode.
Thanks and Regards,
Rahut Patil.

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

回答 (3 件)

madhan ravi
madhan ravi 2019 年 3 月 28 日

0 投票

Screen Shot 2019-03-28 at 4.26.17 PM.png
Screen Shot 2019-03-28 at 4.26.28 PM.png

2 件のコメント

rahut patil
rahut patil 2019 年 3 月 28 日
編集済み: madhan ravi 2019 年 3 月 28 日
Hello Madhan,
I tried but it is giving the following error when I import the vector from workspace. I tried by changing the data types and sample time -1 to 0 and vice versa. But it is giving same error.
=== Simulation (Elapsed: 0.325 sec) ===
Error:Unsupported input format for From Workspace block 'Array/From Workspace'. Available formats are double non-complex matrix, a structure with or without time, or a structure with MATLAB timeseries as leaf nodes. All formats require the data to be finite (not Inf or NaN).
Thanks Regards,
Rahut Patil.
madhan ravi
madhan ravi 2019 年 3 月 28 日
編集済み: madhan ravi 2019 年 3 月 28 日
Share the picture of your model/upload your model by clicking the paper clip button.

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

rahut patil
rahut patil 2019 年 3 月 28 日

0 投票

Plese find the attached model.
Thanks and Regards,
Rahut Patil.

2 件のコメント

rahut patil
rahut patil 2019 年 3 月 28 日
Hi Madhan,
I got the solution. I need to run the array in the command window. But want to assign a value to the perticular array element in the running mode. Can it be possible in simulink? Please suggest.
Thanks Regards,
Rahut Patil.
madhan ravi
madhan ravi 2019 年 3 月 28 日
Screen Shot 2019-03-28 at 7.01.25 PM.png
% MATLAB Function code
function y = fcn(u,index_number,value_assigned)
y = u;
y(index_number) = value_assigned;

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

rahut patil
rahut patil 2019 年 5 月 9 日

0 投票

Hi Madhan,
Sorry for late reply. Thank you so much. It is working. Thank you for the support.
Best Regards,
Rawootray Patil.

カテゴリ

ヘルプ センター および File ExchangeSubsystems についてさらに検索

製品

タグ

質問済み:

2019 年 3 月 28 日

回答済み:

2019 年 5 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by