MATLAB: Number of observed responses

mfilerandom numberssumtotal

Lets say that randomley I choose 10 values, for 'y'. Here, I am saying that the total number of y's is 10 (as opposed to y1 + y2 + …).
How would I find out this in Matlab?
I have assigned random amounts of y to be picked, but the codes I know are total and sum and everytime I do total(y) or sum(y), it adds up all the y numbers (y` + y2 + … yn) instead of telling me the answer 'n' (how many there are).
How do I find this out?
Thank you
EDIT: I think this would be called the number of observed values/responses.

Best Answer

length(y) or numel(y)
Related Question