The function reshapewill do the trick here:
% Arrange the elements of val into a 1x3 array
val = reshape(val, [1 3]);
Since you are converting to a string vector, the following syntax will also work:
val = val(:)';
Because it val(:)creates a column vector, and the transpose operator 'then transfers this column vector to the row vector.
source
share