**any**built-in functions. No x = size(mat). No length(mat). It all has to be done with loops.

I was thinking of writing 2 while loops; one to count the number of columns and one to count the number of rows. The only problem is that I have no idea how to check whether or not a specified row or column exists. I tried the 'exist' function, but that will only tell me if the matrix exists.

any help is appreciated.