Replace the value of one column conditional on another column
古いコメントを表示
I have a problem to generate a vector with varying number of blocks. Suppose A=[0 1;0 1;0 2;0 2;0 2;0 3;0 3;0 3], the last column of A is the index for groups. I want to replace the value of the first column of A for different groups. For example, I want to replace the first few elements of A(:,1) with [0.5;0.8] if the second column equals 1. Replace the block elements of A(:,1) with [0.4, 0.6, 0.8] if the second column equals 2, etc., Is there any easy way to do that? Thanks
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Library Development についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!