Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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

1 vue (au cours des 30 derniers jours)
A D
A D le 18 Jan 2018
Clôturé : MATLAB Answer Bot le 20 Août 2021
I then want to assign this element of the array to a different variable.

Réponses (1)

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

Cette question est clôturée.

Tags

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by