How a fill an array with the same value
조회 수: 104 (최근 30일)
이전 댓글 표시
I would like to fill an array of zeros with all 10s. So for instance,
N=4
V=zeros(N,1)
I want to have V= [10 10 10 10] without writing it manually, how can i do?
thanks
채택된 답변
Star Strider
2020년 8월 17일
Try this:
N=4
V=zeros(N,1) + 10
Note that because of the way you wrote the zeros call, it will be a column vector, not the row vector you posted.
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!