for loop in MATLAB function block

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 commentaire

Jakob B. Nielsen
Jakob B. Nielsen le 24 Fév 2020
Can you post the error? The code ought to run just fine.

Connectez-vous pour commenter.

Réponses (1)

Nishant Gupta
Nishant Gupta le 26 Fév 2020

0 votes

Hi,
You can refer to the model attached here.

1 commentaire

Lau Boon Chong
Lau Boon Chong le 27 Fév 2020
Hi Nishant Gupta
Thank for solving my problem. Have a nice day

Connectez-vous pour commenter.

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Produits

Version

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by