Dear all,
The following macro code used on some of my data is working correctly: 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); } But if I replace the first line with: str = fromCharCode(956); the code isnt working anymore, as up to me "µ" was equal to fromCharCode(956) or am I missing something? Have a nice day, Philippe -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
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 |
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 |
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 |
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 |
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 |
Sorry Philippe,
evidently my code example shows that there is _indeed_ a problem: str = "µ"; //str = fromCharCode(956); xstr = "x [" + str + "m]"; setResult( xstr, 0, 123 ); updateResults(); // //str = "µ"; str = fromCharCode(956); xstr = "x [" + str + "m]"; xval = getResult( xstr , 0 ); print( xval ); str = String.getResultsHeadings; print( str ); Sorry for the confusion Herbie :::::::::::::::::::::::::::::::::::: Am 16.10.17 um 12:01 schrieb Herbie: > 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 > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by CARL Philippe (LBP)
Hi Philippe,
there are several unicode characters that look like the greek mu, Unicode u+00b5 = 181, u+03bc = 956. The first is part of the 'Western' extensions to ascii, the latter is part of the Greek character set. Maybe try with str = fromCharCode(181); Michael ________________________________________________________________ On 16/10/2017 09:32, Philippe CARL wrote: > Dear all, > > The following macro code used on some of my data is working correctly: > > 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); > > } > > But if I replace the first line with: > > str = fromCharCode(956); > > the code isn’t working anymore, as up to me "µ" was equal to > fromCharCode(956) or am I missing something? > > Have a nice day, > > Philippe > > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Michael, dear Philippe!
"Maybe try with str = fromCharCode(181); " str = "µ"; //str = fromCharCode(181); xstr = "x [" + str + "m]"; setResult( xstr, 0, 123 ); updateResults(); // //str = "µ"; str = fromCharCode(181); xstr = "x [" + str + "m]"; xval = getResult( xstr , 0 ); print( xval ); str = String.getResultsHeadings; print( str ); This works here! Best Herbie ::::::::::::::::::::::::::::::::::::::::::: Am 16.10.17 um 12:19 schrieb Michael Schmid: > Hi Philippe, > > there are several unicode characters that look like the greek mu, > Unicode u+00b5 = 181, u+03bc = 956. The first is part of the 'Western' > extensions to ascii, the latter is part of the Greek character set. > > Maybe try with str = fromCharCode(181); > > Michael > ________________________________________________________________ > On 16/10/2017 09:32, Philippe CARL wrote: >> Dear all, >> >> The following macro code used on some of my data is working correctly: >> >> 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); >> >> } >> >> But if I replace the first line with: >> >> str = fromCharCode(956); >> >> the code isn’t working anymore, as up to me "µ" was equal to >> fromCharCode(956) or am I missing something? >> >> Have a nice day, >> >> Philippe >> >> >> -- >> 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 |
Dear Michael and Herbie,
The str = fromCharCode(181); was the solution!!! Thanks a lot for both of you and have a nice day, My best regards, Philippe -----Message d'origine----- De : ImageJ Interest Group [mailto:[hidden email]] De la part de Herbie Envoyé : lundi 16 octobre 2017 12:24 À : [hidden email] Objet : Re: What am I missing with fromCharCode? Dear Michael, dear Philippe! "Maybe try with str = fromCharCode(181); " str = "µ"; //str = fromCharCode(181); xstr = "x [" + str + "m]"; setResult( xstr, 0, 123 ); updateResults(); // //str = "µ"; str = fromCharCode(181); xstr = "x [" + str + "m]"; xval = getResult( xstr , 0 ); print( xval ); str = String.getResultsHeadings; print( str ); This works here! Best Herbie ::::::::::::::::::::::::::::::::::::::::::: Am 16.10.17 um 12:19 schrieb Michael Schmid: > Hi Philippe, > > there are several unicode characters that look like the greek mu, > Unicode u+00b5 = 181, u+03bc = 956. The first is part of the 'Western' > extensions to ascii, the latter is part of the Greek character set. > > Maybe try with str = fromCharCode(181); > > Michael > ________________________________________________________________ > On 16/10/2017 09:32, Philippe CARL wrote: >> Dear all, >> >> The following macro code used on some of my data is working correctly: >> >> 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); >> >> } >> >> But if I replace the first line with: >> >> str = fromCharCode(956); >> >> the code isn’t working anymore, as up to me "µ" was equal to >> fromCharCode(956) or am I missing something? >> >> Have a nice day, >> >> Philippe >> >> >> -- >> 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 |
Free forum by Nabble | Edit this page |