Login  Register

Re: What am I missing with fromCharCode?

Posted by Herbie on Oct 16, 2017; 10:01am
URL: http://imagej.273.s1.nabble.com/What-am-I-missing-with-fromCharCode-tp5019538p5019545.html

Dear Philippe,

I can confirm the issue with your data file but I still think that this
file was written with a different char code convention.

Here is a minimal example that works with both definitions:

str = "µ";
//str = fromCharCode(956);
xstr = "x [" + str + "m]";
setResult( xstr, 0, 123 );
updateResults();
//
xval = getResult( xstr , 0 );
print( xval );
str = String.getResultsHeadings;
print( str );

Best

Herbie

::::::::::::::::::::::::::::::::::::::::::
Am 16.10.17 um 11:26 schrieb Philippe CARL:

> Dear Herbie,
> You shouldn't be scared by the extension name, since the linked file isn't a "real Excel" file, but just a simple tabulation separated ASCII file.
> I actually received the file from a colleague and he gave it an Excel extension to be able to easily open it within that software.
> Also once opened the file is correctly transformed into an ImageJ Results window so it is a plain ImageJ Results window data reading issue.
> Nevertheless, in order to further check your point, I renamed the file extension into ".csv" and replaced the tabulation separators into "," (to fit exactly the way ImageJ is saving Results window data) and the issue is still there.
> My best regards
> Philippe
>
> -----Message d'origine-----
> De : ImageJ Interest Group [mailto:[hidden email]] De la part de Herbie
> Envoyé : lundi 16 octobre 2017 11:08
> À : [hidden email]
> Objet : Re: What am I missing with fromCharCode?
>
> Well Philippe,
>
> I fear this is an issue with the ".xls"-file, not with ImageJ.
>
> I can't go into details because I don't use Excel.
> Did you try using another format for your data, e.g. plain text?
>
> Good luck
>
> Herbie
>
> :::::::::::::::::::::::::::::::::::::::::::
> Am 16.10.17 um 10:51 schrieb Philippe CARL:
>> 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
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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