From: Sourav on 30 Apr 2010 01:09 i have a problem suppose i have a=.3 b=.4 c=2 now i need to sort out the highest value in the form of a,b or c, i am very new to programing(matlab) every time i used "sort[]" function it gives the numerical output, but I need the character, can somebody help me to do the job
From: Walter Roberson on 30 Apr 2010 01:26 Sourav wrote: > i have a problem > suppose i have a=.3 > b=.4 > c=2 > > now i need to sort out the highest value in the form of a,b or c, > i am very new to programing(matlab) > every time i used "sort[]" function it gives the numerical output, but I > need the character, > can somebody help me to do the job Exact results not guaranteed, as it is after midnight here. function varname = sort3name(v1, v2, v3) varname = inputname( 2*(v1 <= v2) + v2 <= v3 + (v1>v2 & v2>v3) ); end highestletter = sort3name(a,b,c);
From: ImageAnalyst on 30 Apr 2010 06:54 Sourav Not sure what you mean by "sort out" (in my part of the world that colloquialism means to "understand"), but if you want to find the highest value you could use this: highestValue = max([a b c]);
From: ImageAnalyst on 30 Apr 2010 07:47 Maybe you mean this: clc; workspace; a=.3 b=.4 c=2 [highestValue indexes] = max([a b c]) inCharacterForm = num2str(highestValue)
From: Sourav on 30 Apr 2010 23:31 thank you thats what i have meant,, thanx a lot for your help
|
Pages: 1 Prev: Finding items in a three layer structure Next: mex using Intel Visual Fortran 11.0 |