MATLAB: Change a vector of a matrix

matrixreplace vector in a matrizvector

Hi, I have a function
function survival(Si) where Si is a matrix (mx8)
Inside the function I create a vector 'status (mx1)', at the end I want to change one of the columns of the matrix Si by 'status'. The idea is that the matrix that the function use as 'entry' change, for use it in the next step. thanks

Best Answer

function Si = survival(Si)
...
status = [...];
column_to_change = ...; %e.g., 7
Si(:,column_to_change) = status;
end