Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Dear List,
The built-in macro language function shows an unexpected behaviour if an "empty" column is present in the string. Example: split("1,2,3,,5",","); returns the same array as: split("1,2,3,5",","); Hence, parsing tables with "empty" cells from csv-files does not work. Is there a way to fix this? We're using ImageJ 1.49b. Thanks for your reply, Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
Am 23.07.2014 18:08, schrieb Gabriel Schweighauser:
> Dear List, > > The built-in macro language function shows an unexpected behaviour if an > "empty" column is present in the string. > > Example: > > split("1,2,3,,5",","); > > returns the same array as: > > split("1,2,3,5",","); > > Hence, parsing tables with "empty" cells from csv-files does not work. > > Is there a way to fix this? > > We're using ImageJ 1.49b. > > > Thanks for your reply, > Gabriel > ... [show rest of quote] Hello Gabriel, we came across this a few days ago. I don't think that it is a bug, since this behaviour might be mandatory in other cases. I wrote a macro function to fill empty fields for which the user has to define a char he wants to fill with. This worked for my purposes. https://dl.dropboxusercontent.com/u/414433/imagej/macros/function_fillEmptyFields.ijm Does it work for you? Best regards, Rainer -- Rainer M. Engel, Dipl. Digital Artist scientific|Media GbR Pichelsdorfer Str. 143 13595 Berlin -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
In reply to this post by Gabriel Schweighauser
Hi Gabriel,
the ImageJ 'split' (in ij.util.Tools) function uses the StringTokenizer, not the String.split function. Thus, multiple occurrences of the same delimiter are taken as one. Especially with whitespace characters as separators, this is usually the desired behavior. I fear that changing this may break existing macros that rely on the current split function. A way out would be having a second split function with a different name or a split function that behaves like String.split, but I don't know whether it's worth while. A workaround might be adding spaces between the commas: s="1,2,3,,5,,,8,,,,12,,,,,17"; s1=replace(replace(s,",,",", ,"),",,",", ,"); print(s1); a=split(s1,","); print(lengthOf(a)); Michael ________________________________________________________________ On Jul 23, 2014, at 18:08, Gabriel Schweighauser wrote: > Dear List, > > The built-in macro language function shows an unexpected behaviour if an > "empty" column is present in the string. > > Example: > > split("1,2,3,,5",","); > > returns the same array as: > > split("1,2,3,5",","); > > Hence, parsing tables with "empty" cells from csv-files does not work. > > Is there a way to fix this? > > We're using ImageJ 1.49b. > > > Thanks for your reply, > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html ... [show rest of quote] -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
In reply to this post by Gabriel Schweighauser
On Jul 23, 2014, at 12:08 PM, Gabriel Schweighauser wrote:
> Dear List, > > The built-in macro language function shows an unexpected behaviour if an > "empty" column is present in the string. > > Example: > > split("1,2,3,,5",","); > > returns the same array as: > > split("1,2,3,5",","); > > Hence, parsing tables with "empty" cells from csv-files does not work. > > Is there a way to fix this? ... [show rest of quote] This bug is fixed in the latest ImageJ daily build (1.49e10). -wayne -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Disable Popup Ads | Edit this page |