Non zero min 3D matrix
3 views (last 30 days)
I have 3D matrix of A(k,l,t) where t is time. I want to find the non zero min of each row for every t.
for t =1:10
for k = 1:10
f(k,1,t) = max(A(k,:,t)(A(k,:,t)>0));
it shows error ()-indexing must appear last in an index expression.
I was trying to use f = min(A(A>0))
More Answers (1)
Raghunandan V on 12 Mar 2019
You can remove all the for loops and make it more effecient
A(A==0) = inf;
Here I am just replacing the 0 with inf and then finding the minimum. This code even works for matrix with negative integers. :)