I have been harassed for a long time, any help will be greatly appreciated. I am looking for a computationally cheap way to find the median of nonzero elements in each row of a sparse matrix S=sparse(,,,32768,240,000,50*240000); There are nonzero elements assigned to S, which is not shown here.
Here is how I do to find the median, but I am not satisfied with the efficiency
[row,col,v] = find(S);
Also, it's much worse to replace zero with NaN, then use nanmedian or median(___,nanflag). It's not practicable at all due to assign many NaN to a large sparse matrix.
Is there any other more efficient way to implement this? I am think about a way without using loop.
Thank you very much for any of your time and energy.