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!