Covert the following WL code to Matlab code?

I am new to mathematica and having trouble understanding the syntax.

The code:

findMax[{b_, w_}, v_] := Min[Select[Join[Table[If[v[[i]] != 0, \[Lambda] /.Solve[(b + w*(0.5 + \[Lambda]*v))[[i]] == 0, \[Lambda]][[1]], -1], {i, 3}],
    Table[If[v[[i]] != 0, \[Lambda] /.Solve[(b + w*(0.5 + \[Lambda]*v))[[i]] == 1, \[Lambda]][[1]], -1], {i, 3}]], # > 0 &]]

My corresponding matlab code is:

for i=1:3
    if(v(i)~=0)
        a=(-b/w);
        lambdas =(a-0.5)/v(i);
        lmat(ind)=(lambdas);
    end
    ind=ind+1;
end

for i =1:3
    if(v(i)~=0)
        lambdas=(((1-gb)/w)-0.5)/v(i);
        lmat(ind)=(lambdas);
    end
end
%lam=(max(lmat));
%added
lam=(min(lmat));

Is my matlab implementation correct?

Any help would be really appreciated.

You ask to convert WL code to Matlab code, yet you say you’re new to Mathematica and having trouble understanding the syntax.

Which system’s syntax is it that you’re having trouble with — WL or Mathematica?

And could you tell us in words and symbols exactly what it is that you’re trying to accomplish?