Info
此问题已关闭。 请重新打开它进行编辑或回答。
finding min nummber in a vector
1 次查看(过去 30 天)
显示 更早的评论
hi :}
I got to write a program in one code line.
Finding minimum num in a vector without using min or max functions.
1 个评论
回答(2 个)
KSSV
2017-7-28
You arrange your vector in ascending order using sort and pick the first number.
V = rand(10,1) ;
V = sort(V,'ascend') ;
iwant = V(1)
5 个评论
Image Analyst
2017-7-29
OK, then I guess we can put both "statements" on one line of code:
V = sort(V,'ascend'); iwant = V(1)
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!