Matlab: add vector to matrix

前端 未结 2 775
滥情空心
滥情空心 2021-01-02 22:06

I have a 3XN matrix representing a list of 3D coordinates,something like

33    33    33    33    34    34    34    34    34    35    35
17    18         


        
2条回答
  •  清酒与你
    2021-01-02 22:21

    you mean like this?

    D=[33    33    33    33    34    34    34    34    34    35    35;
    17    18    19    20    16    17    18    19    20    16    17;
    10    10    10    10    10    10    10    10    10    10    10 ];
    
    A=[1 2 3]';
    
    C= bsxfun(@plus, D, A)
    
    C =
    
        34    34    34    34    35    35    35    35    35    36    36
        19    20    21    22    18    19    20    21    22    18    19
        13    13    13    13    13    13    13    13    13    13    13
    

提交回复
热议问题