Question: Say I'm using this piece of code

```
With TextBox
.Size = New Windows.Size(InsideRadius)
End With

```

I want to choose within the function call which size to use dependent on which is the biggest, If Inside Radius is the biggest then choose that, but if a number such as say 20 is bigger then pick that, all within the call.

So something like this

```
With TextBox
.Size = New Windows.Size(If (InsideRadius >= 20) Then InsideRadius Else 20 End If)
End With

```

but I'm unsure how to do this within vb.net, I'm sure it is possible but after some searching I think I'm not typing in the correct question to get what I am looking for. Hope you understand, thanks

Answer: 
Your attempt probably does not work because of floating point rounding errors. You can read more about it [here](https://fr.mathworks.com/matlabcentral/answers/57444-faq-why-is-0-3-0-2-0-1-not-equal-to-zero). You could look into the the [eps function](https://fr.mathworks.com/help/matlab/ref/eps.html), or just use this example:

```
% Your matrix
M = randn(50943 , 3);

% The coordinates you are looking for
P = [0,0,0];

% Distance between all coordinates and target point
D = sqrt(sum((M - bsxfun(@minus,M,P)).^2,2));

% Closest coordinates to target
[~ , pos] = min(D);

% Display result
disp(M(pos , :))

```
Try the following:

```
mat = randi(30,50943,3);
vec = [1,2,3];
% R2106b+ code
ind = find(all(mat==vec,2));
% or: explicit expansion, works with all versions
ind = find(all(bsxfun(@eq,mat,vec),2));

```

What it does:
`==` or `eq` will check if coordinates are equal (gives a [50943x3] bool matrix)
`all` will return true only if all coordinates are equal
`find` returns the index of all non zero elements

This works only for an exact match (hence the integer coordinates picked with `randi`).

---

Since the answer is already accepted, I'll add @Zep answer that provide a solution to get the nearest point, which seem to be what was initially sought.

```
[min_dist,ind_nearest] = min(sum(bsxfun(@minus,mat,vec).^2,2)); % index to the nearest point

```