I want to create a function were i will input 3 numbers and after check thoose 3 number, also i will have 3 temporary variables were in variable
_hig i will give higest number between 3 numbers
_low1 & _low2 i will give other 2

that can be done with 20+ if in MATLAB

function myf(a,b,c)

_hig = 0;
_low1 = 0;
_low2 = 0;

// After

if a > b && a > c
   _high= a;
   low1 = b;
   low2 = c;  // doesn't matter low1/low2 , wich first wich 2nd
elseif a > b && a < c
  _high = c;
  _low1 = a;
  _low1 = b;
elseif a < b && a > c
  _high = b;
  _low1 = a;
  _low1 = c;
........
........
// This way will take to much statements

i want a easy way in MATLAB , dont tell me about switch :)

i try also with min(),max()

function myf(a,b,c)

%create an array because MATLAB functions can't take over 2 
x = [a,b,c];
_high = max(x);

% i want to return 2 lowest values in _low1/_low2 but it dont work like this, it return same value on _low1/_low2
[_low1,_low2] = min(x);

That i want is to give (a,b,c) values to _higest/_low1/_low2, after i have to check if values i give make a triangle, and if yes then what about it is, is right angled? is acute? or abtuse....

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.