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 Kommentar

Jakob B. Nielsen
Jakob B. Nielsen am 24 Feb. 2020
Can you post the error? The code ought to run just fine.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Nishant Gupta
Nishant Gupta am 26 Feb. 2020

0 Stimmen

Hi,
You can refer to the model attached here.

1 Kommentar

Lau Boon Chong
Lau Boon Chong am 27 Feb. 2020
Hi Nishant Gupta
Thank for solving my problem. Have a nice day

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Loops and Conditional Statements finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2019a

Gefragt:

am 23 Feb. 2020

Kommentiert:

am 27 Feb. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by