MATLAB: Checking if a matrix is right dimensions.

if statementmatrixmatrix manipulationnumel

I have this code for a user to enter coordinates. This creates then the matrix y and x.
n=10; % number of lines
a= inputdlg('enter x coordinates','test',n)
x=str2num(a{1})
b= inputdlg('enter y coordinates','test',n)
y=str2num(a{1})
I want to make it so that if there is unequal numbers of y and x cordinates a error message is displayed. Would I use if, else statements using the numel command to check if numel of x equalls y.
Thanks,

Best Answer

Try
if length(a{1})~=length(b{1})
error(' Vectors must have same length');
end