Or, if dim = 2, then y is a dataset array containing k variables selected from data. If data is a dataset array and dim = 1, then y is a dataset array containing k rows selected from data. Or, if dim = 2, then y is a table containing k variables selected from data. If data is a table and dim = 1, then y is a table containing k rows selected from data. Or, if you specify a value for the dim name-value pair argument, datasample samples along the dimension dim. If data is an N-dimensional array and dim = 1, then y is an N-dimensional array of samples taken along the first nonsingleton dimension of data. Or, if dim = 2, then y is a matrix containing k columns selected from data. If data is a matrix and dim = 1, then y is a matrix containing k rows selected from data. If data is a vector, then y is a vector containing k elements selected from data.