generate tensor matlab array from input data