Adding a single number to an entire matrix
239 次查看(过去 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!