I currently have:
val(:,:,1) =
0.7216
val(:,:,2) =
0.7216
val(:,:,3) =
0.7216
But I want
0.7216, 0.716, 0.721.
What sort of operation can I do to do that?
I currently have:
val(:,:,1) =
0.7216
val(:,:,2) =
0.7216
val(:,:,3) =
0.7216
But I want
0.7216, 0.716, 0.721.
What sort of operation can I do to do that?
The reshape
function will do the trick here:
% Arrange the elements of val into a 1x3 array
val = reshape(val, [1 3]);
Because you are converting to a row-vector, the following syntax will also work:
val = val(:)';
Because val(:)
creates a column-vector, and the transpose operator '
then transposes that column-vector into a row-vector.
val = val(:)';
This should do the trick.
(:)
will convert it to a column.
'
will transpose it to a row