Login  Register

Re: getResult to Array gives NaN

Posted by PEARSON Matthew on Oct 24, 2016; 3:57pm
URL: http://imagej.273.s1.nabble.com/getResult-to-Array-gives-NaN-tp5017460p5017462.html

Hi Herbie,

I did wonder about this but yet i have an array earlier in my macro which stores only 2 values, the first is a string and the second a number.  Does this somehow indicate that specifically you cannot create an array of numbers and strings when extracting from the results table using getResult?

Thanks,

Matt

--
Matt Pearson
Microscopy Facility
MRC Human Genetics Unit
Institute of Genetics and Molecular Medicine (IGMM)
University of Edinburgh
Crewe Road
EH4 2XU




On 24 Oct 2016, at 16:36, Herbie <[hidden email]<mailto:[hidden email]>>
 wrote:

Good day Matt,

you can't have strings and numerical values in the same array.

Therefore, you may convert the values to strings to end up with a pure string array. If you like to read the values back from the string array, you have to convert them from strings to numbers.

HTH

Herbie

:::::::::::::::::::::::::::::::::::::::::::::
Am 24.10.16 um 17:22 schrieb PEARSON Matthew:
Hi all,

I'm having a bit of an issue with taking values from the results
table and putting them into an array.  The first column of the
results table contains a string, the current images title stored as a
variable such as "test.tif" all other columns contain numbers.  The
results table displays fine but when i loop through using getResult
to put all the table values into an array, when i print the resultant
array (Array.print) the values from the first column containing
strings are listed as NaN.  How can i correct this?  Ultimately when
i use this array to produce the final results table the first column
is then filled with NaN.

Thanks for the help,

Matt


-- Matt Pearson Microscopy Facility MRC Human Genetics Unit Institute
of Genetics and Molecular Medicine (IGMM) University of Edinburgh
Crewe Road EH4 2XU





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



The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

-- 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