필터 지우기
필터 지우기

Adding a value to a vector

조회 수: 3 (최근 30일)
Chau Chin Haw
Chau Chin Haw 2021년 1월 16일
댓글: Jan 2021년 1월 16일
I have vector x
x=[ 1 2 3 ]
I want i add value 4 to every value in x
[ 1 2 3 ] + 4
Expected outcome
x=[ 5 6 7 ]
How can i perform this in matlab?
  댓글 수: 1
Jan
Jan 2021년 1월 16일
Did you try this? [ 1 2 3 ] + 4 is working already.

댓글을 달려면 로그인하십시오.

답변 (1개)

Cris LaPierre
Cris LaPierre 2021년 1월 16일
The same way. What have you tried?
See Ch 6 of MATLAB Onramp.
x=[ 1 2 3 ];
x=x + 4
x = 1×3
5 6 7

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by