for loop in MATLAB function block

6 visualizaciones (últimos 30 días)
Lau Boon Chong
Lau Boon Chong el 23 de Feb. de 2020
Comentada: Lau Boon Chong el 27 de Feb. de 2020
Hi All
I want to run a simple for loop a shown below:
for i = 1:4
x(i) = rand(1,1);
end
The function block shows error. Any idea to run for such for loop in MATLAB function block as I need this for loop to write a long code? Thank you
  1 comentario
Jakob B. Nielsen
Jakob B. Nielsen el 24 de Feb. de 2020
Can you post the error? The code ought to run just fine.

Iniciar sesión para comentar.

Respuestas (1)

Nishant Gupta
Nishant Gupta el 26 de Feb. de 2020
Hi,
You can refer to the model attached here.
  1 comentario
Lau Boon Chong
Lau Boon Chong el 27 de Feb. de 2020
Hi Nishant Gupta
Thank for solving my problem. Have a nice day

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by