Adding a single number to an entire matrix
259 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Star Strider
el 13 de Mayo de 2021
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 comentarios
Walter Roberson
el 4 de Feb. de 2023
What is
size(s_combined_projected_tc_and_predicted_sw)
size(s_get_projected_MMSL)
at the time of the problem?
David Ebert
el 4 de Feb. de 2023
Editada: David Ebert
el 4 de Feb. de 2023
Oh, I have made a mistake. I'm sorry. One of the values was not found, giving an empty vector, no wonder.
Ver también
Categorías
Más información sobre Matrix Indexing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!