MATLAB: Matching matrices sizes using if statements

matricessize;

Good Afternoon,
I was wondering if someone could assist me on an if condition. I have two data sets A [nx3] and B[mx3]. I would like the rows of each data set to match one another with repeat values of that data set. For example if
A=[ 1 2 3;
4 5 6;
7 8 9]
and
B=[4 5 8;
1 2 7].
Then B would become
[4 5 6;
1 2 7;
4 5 6];
Something like
[ar,ac]=size(A);
[br,bc]=size(B);
if ar = br
A;
B;
if ar > br
if ar < br
Any suggestions?
Thanks!!
[Melissa, I took a little free rein to edit your code and make the question a little clearer. — the cyclist]

Best Answer

A=[ 1 2 3;...
4 5 6;...
7 8 9];
B=[4 5 8;...
1 2 7];
[ma,na]=size(A);
[mb,nb]=size(B);
if ma>mb
N=ceil(ma/mb);
B=repmat(B,N,1);
B=B(1:ma,:)
elseif mb>ma
N=ceil(mb/ma);
A=repmat(A,N,1);
A=A(1:mb,:)
end
%else they have equal number of rows, no operation needed.