> 其他 >
7.求500个元素的随机数向量A中大于0.5的元素个数.怎么用matlab做这道题啊,
人气:491 ℃ 时间:2020-02-06 01:14:53
解答
试试这样:
clear all;clc;
A=rand(1,500);
sum=0;
for ii=1:length(A)
if A(ii)>0.5
sum=sum+1;
end
end
sum
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版