Login  Register

Re: What am I missing with fromCharCode?

Posted by CARL Philippe (LBP) on Oct 16, 2017; 8:51am
URL: http://imagej.273.s1.nabble.com/What-am-I-missing-with-fromCharCode-tp5019538p5019540.html

Hallo Herbie,
The code you posted works indeed perfectly for me.
And such code is actually the reason why the found behavior is quite strange (or maybe I'm doing a mistake somewhere).
The following code:
        http://punias.free.fr/ImageJ/Maxime/plot_MtrackJ.ijm
applied on the following data:
        http://punias.free.fr/ImageJ/Maxime/all_track_points_s001.xls
will illustrate my issue.
If you launch the code as it is (i.e. with str = fromCharCode(956) being active on line 19) the code won't work.
But if you put the line 19 (with str = fromCharCode(956)) as comment and put the comment away from the line 18 (with str = "µ") the code will then work.
So using "µ" or fromCharCode(956) seems not be interpreted the same way if later used within a getResult instruction.
My best regards,
Philippe

-----Message d'origine-----
De : ImageJ Interest Group [mailto:[hidden email]] De la part de Herbie
Envoyé : lundi 16 octobre 2017 10:15
À : [hidden email]
Objet : Re: What am I missing with fromCharCode?

Bonjour Philippe!

Does the following code work for you?

str = "µ";
xstr = "x [" + str + "m]";
ystr = "y [" + str + "m]";
print( xstr, ystr );
str = fromCharCode(956);
xstr = "x [" + str + "m]";
ystr = "y [" + str + "m]";
print( xstr, ystr );

No problems here.

Regards

Herbie

::::::::::::::::::::::::::::::::::::::::::
Am 16.10.17 um 09:32 schrieb Philippe CARL:

> str     = "µ";
>
>                  xstr   = "x [" + str + "m]";
>
>                  ystr   = "y [" + str + "m]";
>
>                  
>
>                  for (i = 0; i != nResults; i++)
>
>                  {
>
>                                  xval  [i] = getResult(xstr , i);
>
>                                 yval  [i] = getResult(ystr , i);
>
>                  }

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html