How to fill an array with the elements of a for loop?
조회 수: 12 (최근 30일)
이전 댓글 표시
Hi, i have this code, and i want to put all of the elements from the loop inside an array, can anyone help me?
ll=[1 2 3 4 5]
for c= 1:1:length(ll)
element=ll(c)+3
end
%%result==>> ll= 4 5 6 7 8
댓글 수: 2
Geoff Hayes
2021년 7월 8일
Juan - do you need to use a loop? What happens if you just do
element = ll + 3;
?
채택된 답변
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!