MATLAB: Masking an array back to a selected region in a Matrix

indexingmatrix manipulation

Hi,
I have a column vector which I need to insert back to the a matrix(Attached in .mat file). The variable region has logicals in the places where I want to put the data given by variable name vdisp_selected. Is there an efficient way of achieving this by masking?
I tried to play around with masking based on region but I am getting a square region in the end.
Cheers,

Best Answer

out = double(region);
out(region) = vdisp_selected;
Related Question