MATLAB: How to make a table with multiple variables

table

I need to make a table that is 7×5 with these variables:
mass=[50:5:80]; (this is the 7 columns) and height=[1.5:.1:1.9]; (these are the 5 rows).
I have this equation:
>> BMI=[mass]./[height].^2
And it says "Matrix Dimensions Must Agree". I thought since I have the periods in front of the "/" and the "^" that I wouldn't have that problem, so I don't know why it won't give me a table?

Best Answer

You've only created two vectors, not matrices. You're basically trying to divide a 1-by-5 by a 1-by-7 which doesnt work. What you probably want is:
[M,H] = meshgrid(mass,height);
BMI = M./(H.^2);
Related Question