How to manually add matrices using only for loops

I have 2 matrices which have no conditions C and D. How do I express using only for loops that they should undergo addition to create another matrix.

4 comentarios

Can you elaborate once, what you want to do.
Qasim Mahmood
Qasim Mahmood el 10 de Dic. de 2019
I have to do C + D which is matrix addition however I can't use the in built function in MATLAB. I can only use for loops. I have to do the same for C - D and C*D. This is all within a function hence C and D are random matrices.
Adam
Adam el 11 de Dic. de 2019
Your matrices need to have one condition - that they are the same size, otherwise how are you defining addition?
Qasim Mahmood
Qasim Mahmood el 11 de Dic. de 2019
That condition was automatically assumed by me since it's the fundamental of matrix addition.

Iniciar sesión para comentar.

Respuestas (1)

KALYAN ACHARJYA
KALYAN ACHARJYA el 10 de Dic. de 2019
Here Loop is not required
result=C+D

2 comentarios

Qasim Mahmood
Qasim Mahmood el 10 de Dic. de 2019
The question i'm trying to answer says I can't use the in-built functions.
Hi,
Using '+' in code will not be considered that you have used inbuilt function.

Iniciar sesión para comentar.

Categorías

Más información sobre Loops and Conditional Statements en Centro de ayuda y File Exchange.

Preguntada:

el 7 de Dic. de 2019

Comentada:

el 11 de Dic. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by