Info
此问题已关闭。 请重新打开它进行编辑或回答。
Finding the first element of a 1-D array that yields a negative result.
2 次查看(过去 30 天)
显示 更早的评论
I then want to assign this element of the array to a different variable.
0 个评论
回答(1 个)
Kaushik Lakshminarasimhan
2018-1-19
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 个评论
此问题已关闭。
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!