There is no shape= argument in MATLAB. Outputs always come back as N x 1 column vectors, and you can reshape them yourself. out = kernel.run(din); out_row = reshape(out, 1, []); % row vector out_2d = reshape(out, 4, []); % 2-D matrix