That is not allowed in MATLAB, as your error says.
To use the size function on a multi-dimensional array (matrix), use size(data, 1) to get the number of rows and size(data, 2) to get the number of columns.
Here is the (first bit of the) result from help size on MATLAB.
>>help size
'size' is a built-in function from the file libinterp/corefcn/data.cc
-- Built-in Function: size (A)
-- Built-in Function: size (A, DIM)
Return the number of rows and columns of A.
With one input argument and one output argument, the result is
returned in a row vector. If there are multiple output arguments,
the number of rows is assigned to the first, and the number of
columns to the second, etc.
Similarly, if you have a matrix A = [1, 2, 3; 4, 5, 6], use the same method to access the elements. For example, A(1,1) = 1 (NOT A(1)(1)), and A(2,2) = 5.
Cheers!
EDIT:
Also, did you mean data = [[3,4,56,1,2];[3,1,3,45,2]]; (notice the semi-color separating the rows)? Because data = [[3,4,56,1,2],[3,1,3,45,2]]; would return a long 10-dimensional vector instead of a 5x2 matrix.
size(data)(2).