How to define data array in simulink

88 visualizaciones (últimos 30 días)
rahut patil
rahut patil el 28 de Mzo. de 2019
Respondida: rahut patil el 9 de Mayo de 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 comentarios
madhan ravi
madhan ravi el 28 de Mzo. de 2019
Use constant block, what do you mean by read and write the array individually?
rahut patil
rahut patil el 28 de Mzo. de 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.

Iniciar sesión para comentar.

Respuestas (3)

madhan ravi
madhan ravi el 28 de Mzo. de 2019
Screen Shot 2019-03-28 at 4.26.17 PM.png
Screen Shot 2019-03-28 at 4.26.28 PM.png
  2 comentarios
rahut patil
rahut patil el 28 de Mzo. de 2019
Editada: madhan ravi el 28 de Mzo. de 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 el 28 de Mzo. de 2019
Editada: madhan ravi el 28 de Mzo. de 2019
Share the picture of your model/upload your model by clicking the paper clip button.

Iniciar sesión para comentar.


rahut patil
rahut patil el 28 de Mzo. de 2019
Plese find the attached model.
Thanks and Regards,
Rahut Patil.
  2 comentarios
rahut patil
rahut patil el 28 de Mzo. de 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 el 28 de Mzo. de 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;

Iniciar sesión para comentar.


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

Categorías

Más información sobre Subsystems en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by