fast sum 3D matrix, Mex file
显示 更早的评论
Hello,
I would like to sum all pixels values of a 3D matrix in one dimension and put the final result in a 2D matrix. For example, the input is a 3D matrix: A(1280,1280,700). And the output is a 2D array: D(:,:) = A(:,:,1)+A(:,:,2)+A(:,:,3)+.....
As you can see in the mex file (test.c), the sum of all pixels is stored in a variable: pix. But while storing this variable into the array, the calculation time become very long: >40 sec... I don't understand why the writing into an array is taking so long. Is there a way to improve the Mex function in order to compute the algorithme faster?
Thank you for your answer.
Kind regards, Fouad
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Programming 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!