Adding a single number to an entire matrix
조회 수: 259 (최근 30일)
이전 댓글 표시
How do you add a single number to each element within a matrix?
i.e.
a = 5
b = (1,2,3;4,5,6;7,8,9)
c = a + b
댓글 수: 0
답변 (1개)
Star Strider
2021년 5월 13일
Exactly as you wrote it!
a = 5
b = [1,2,3;4,5,6;7,8,9]
c = a + b
Use square brackets [] to code vectors and matrices.
댓글 수: 5
Walter Roberson
2023년 2월 4일
What is
size(s_combined_projected_tc_and_predicted_sw)
size(s_get_projected_MMSL)
at the time of the problem?
David Ebert
2023년 2월 4일
편집: David Ebert
2023년 2월 4일
Oh, I have made a mistake. I'm sorry. One of the values was not found, giving an empty vector, no wonder.
참고 항목
카테고리
Help Center 및 File Exchange에서 Matrix Indexing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!