how to solve this code ??
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello;
how i can change this code to get the specific output
clc;clear all;
for i=1:10;
a=i+5;
end
the final value of a =15 , i need a =[ 6 7 8 9 10 11 12 13 14 15];
thanks
댓글 수: 0
채택된 답변
Walter Roberson
2016년 9월 26일
You are overwriting all of a each iteration of the loop. You need to instead only assign to one particular vector element:
a(i) = i + 5;
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!