Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

Finding the first element of a 1-D array that yields a negative result.

2 Ansichten (letzte 30 Tage)
A D
A D am 18 Jan. 2018
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
I then want to assign this element of the array to a different variable.

Antworten (1)

Kaushik Lakshminarasimhan
Kaushik Lakshminarasimhan am 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

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by