change a vector of a matrix
1 回表示 (過去 30 日間)
古いコメントを表示
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
0 件のコメント
採用された回答
Walter Roberson
2013 年 6 月 12 日
function Si = survival(Si)
...
status = [...];
column_to_change = ...; %e.g., 7
Si(:,column_to_change) = status;
end
0 件のコメント
その他の回答 (1 件)
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
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!