How to define data array in simulink

89 Ansichten (letzte 30 Tage)
rahut patil
rahut patil am 28 Mär. 2019
Beantwortet: rahut patil am 9 Mai 2019
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 Kommentare
madhan ravi
madhan ravi am 28 Mär. 2019
Use constant block, what do you mean by read and write the array individually?
rahut patil
rahut patil am 28 Mär. 2019
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.

Melden Sie sich an, um zu kommentieren.

Antworten (3)

madhan ravi
madhan ravi am 28 Mär. 2019
Screen Shot 2019-03-28 at 4.26.17 PM.png
Screen Shot 2019-03-28 at 4.26.28 PM.png
  2 Kommentare
rahut patil
rahut patil am 28 Mär. 2019
Bearbeitet: madhan ravi am 28 Mär. 2019
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 am 28 Mär. 2019
Bearbeitet: madhan ravi am 28 Mär. 2019
Share the picture of your model/upload your model by clicking the paper clip button.

Melden Sie sich an, um zu kommentieren.


rahut patil
rahut patil am 28 Mär. 2019
Plese find the attached model.
Thanks and Regards,
Rahut Patil.
  2 Kommentare
rahut patil
rahut patil am 28 Mär. 2019
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 am 28 Mär. 2019
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;

Melden Sie sich an, um zu kommentieren.


rahut patil
rahut patil am 9 Mai 2019
Hi Madhan,
Sorry for late reply. Thank you so much. It is working. Thank you for the support.
Best Regards,
Rawootray Patil.

Kategorien

Mehr zu Subsystems finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by