How to add a value to a already existing matrix?

KB=[1 3;4 5] for i:Nbarras Mgl(i,1)= Mgl(i,1) + KB(i,1)
which method is correct? for i:Nbarras Mgl(i,1)= Mgl(i,1) + KB(i,1)
or for i:Nbarras Mgl(i,1)=+KB(i,1)
or somehow else?

 Akzeptierte Antwort

Mahesh
Mahesh am 7 Sep. 2014

0 Stimmen

I hope the correct one, if you have already defined Mgl, is
Mgl(1,1)= Mgl(1,1) + KB(1,1)
Good luck

2 Kommentare

Rachuan
Rachuan am 7 Sep. 2014
When i do it like that it shows
"Undefined function 'Mgl' for input arguments of type 'double'."
you need to define Mgl matrix if you do not have like
Mgl = zeros(2,2)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink finden Sie in Hilfe-Center und File Exchange

Gefragt:

am 7 Sep. 2014

Kommentiert:

am 7 Sep. 2014

Community Treasure Hunt

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

Start Hunting!

Translated by