apply bsxfun or arrayfun to every row of a matrix

前端 未结 2 1590
面向向阳花
面向向阳花 2021-01-19 02:28

There are two matrices, A and B with size m-by-4 and n-by-4 respectively. My question is how to apply a function f<

2条回答
  •  广开言路
    2021-01-19 02:52

    This functionality is built into rectint. For the syntax rectint(A,B):

    A and B can also be matrices, where each row is a position vector. AREA is then a matrix giving the intersection of all rectangles specified by A with all the rectangles specified by B. That is, if A is M-by-4 and B is N-by-4, then AREA is an M-by-N matrix...

    So, you can just do result = rectint(A,B); to get the matrix you are after.

提交回复
热议问题