Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Can you help me with this in Matlab

I have this matrix
A= 10 20 30
40 60 70
80 90 100

B= 1 1 1
1 1 1

how can i add matrix B into the end of matrix A to look like this

C= 10 20 30
40 60 70
80 90 100
1 1 1

What I have tried:

i cant find the right function
Posted
Updated 9-Mar-22 22:29pm

1 solution

Here's the solution:

And, this is done in MatLab just like in Python and NumPy, such as:

For rows:

Python
A = ones(1,4);
B = zeros(1,4);
C = [A B]
D = [A;B]


For columns:

Python
A = ones(2,3)
B = zeros(2,2)
C = [A B]


I basically refer to Creating, Concatenating, and Expanding Matrices- MATLAB & Simulink[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900