필터 지우기
필터 지우기

change a vector of a matrix

조회 수: 1 (최근 30일)
Vanessa
Vanessa 2013년 6월 12일
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

채택된 답변

Walter Roberson
Walter Roberson 2013년 6월 12일
function Si = survival(Si)
...
status = [...];
column_to_change = ...; %e.g., 7
Si(:,column_to_change) = status;
end

추가 답변 (1개)

David Sanchez
David Sanchez 2013년 6월 12일
use the matrix as an output argument too:
function Si = survival(Si)
%your code here, you can change your Si matrix too

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by