map a matrix with another matrix

后端 未结 2 1492
终归单人心
终归单人心 2021-01-24 11:04

I have a question to the mapping of a matrix with another matrix which contains only 1 and 0. Here an example of my problem: A is the matrix with doubles



        
2条回答
  •  渐次进展
    2021-01-24 11:58

    I like Dan's solution, but this would be another way:

    C = zeros(size(A));
    C(B==1) = A(B==1);
    

提交回复
热议问题