Adding Zeros vectors within a matrix
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Kevin Smith
am 21 Apr. 2019
Kommentiert: Kevin Smith
am 22 Apr. 2019
I have a 3x3 matrix of values ex
A=[ 1 2 3;
4 5 6;
7 8 9]
I need it to add zeros at certain locations with in the matrix to make a 5x5 with zeros in the 3rd and 4th row and column ex
A2=[1 2 0 0 3;
4 5 0 0 6;
0 0 0 0 0;
0 0 0 0 0;
7 8 0 0 9]
my first attempt was concatenate but I can't figure out how to move the values correctly
newA=[A,zeros(3,2)]
newA_1=[newA;zeros(2,5)]
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!