Reputation: 833
I would like to return the maximum value between two, but return the variable that is assigned to that number...not the number itself.
A = 3
B = 7
max(A,B)
7
Instead, I would like to return
'B'
I am sorry if this is an obvious question. I just have not found an answer online.
Upvotes: 0
Views: 118
Reputation: 1081
if B >= A
Bigvar='B';
else
Bigvar='A';
end
But I should say that in general if you need to know a variable name the way you describe then there are probably better ways of structuring your code. That's why it doesn't come up when you search.
Upvotes: 1