function C = wv_rows(M) % WV_ROWS Matrix to a cell array of rows, for jsonencode. % % jsonencode([1 2 3]) is [1,2,3], not [[1,2,3]], so a matrix with a single row % arrives on the JavaScript side with the wrong nesting. Encoding a cell array % of rows instead always gives an array of arrays. n = size(M, 1); C = cell(1, n); for i = 1:n C{i} = M(i, :); end end