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 Comment

Can you post the error? The code ought to run just fine.

Sign in to comment.

Answers (1)

Nishant Gupta
Nishant Gupta on 26 Feb 2020
Hi,
You can refer to the model attached here.

1 Comment

Hi Nishant Gupta
Thank for solving my problem. Have a nice day

Sign in to comment.

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Release

R2019a

Asked:

on 23 Feb 2020

Commented:

on 27 Feb 2020

Community Treasure Hunt

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

Start Hunting!