Turning for outputs into a row vector
이전 댓글 표시
I need to get all of the outputs of b into a row vector size [1 5] so b=[4,1,0,1,4]
for a=-2:2
b=a.^2
end
Outputs are
b=4
b=1
b=0
b=1
b=4
I tried
for a=-2:2
b(a)=a.^2
end
I got, Array indices must be positive integers or logical values. So then I tried
for a=-2:2
b(1:a)=a.^2
end
But I did not get what I wanted.
댓글 수: 1
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Mathematics에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!