MATLAB: MATLAB_Built in Functions Zeros and Ones 4×5 Matrix

homeworkMATLABmatrix ones zeros

Hello ,
My question is ; Please use the MATLAB built in functions zeros and ones to create a 4×5 matrix in which the first two rows are zero and the next two rows are 1.
>> A=zeros(4,5)
A =
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
0 0 0 0 0
>> B=ones(4,5)
B =
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
1 1 1 1 1
How can I make first two rows zeros and last two rows ones based on above matrixes. I kindly request your help. Thank you…

Best Answer

A=zeros(2,5);
B=ones(2,5);
iwant=[A;B]