convert for loop's answers into a vector
3 次查看(过去 30 天)
显示 更早的评论
采纳的回答
KSSV
2021-9-2
mean(aR2) is a scalar value, why you want to store it into a vector?
Are you looking for saving values in a loop into a array? Then consider below example.
n = 30 ;
A = rand(1,n) ;
iwant = zeros(1,n) ;
for i = 1:n
iwant(i) = rand*A(i)
end
The above can alos be achieved without loop.
更多回答(1 个)
Chunru
2021-9-2
The following is not really a conversion and more a correction;
aR2=rand(1,30);
maR2= mean(aR2)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!