Info
This question is closed. Reopen it to edit or answer.
Finding the first element of a 1-D array that yields a negative result.
1 view (last 30 days)
Show older comments
I then want to assign this element of the array to a different variable.
0 Comments
Answers (1)
Kaushik Lakshminarasimhan
on 19 Jan 2018
x = normrnd(0,1,[1,20]); % generate 20 random numbers
y = x(find(x<0,1)); % assign the first negative random value to y
0 Comments
This question is closed.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!