At 01:56 PM 7/22/2005, you wrote:
>In a macro, I've been calculating statistics based on results from
>'analyze particles', and I'm sending the results to the 'log' window with
>a 'print' statement.
>
>This is fine when the statistics are defined as variables, but for some
>statistics (histogram bins & percentiles), I need to use arrays: the
>number of bins and percentiles is user-defined.
>
>Is there any way to print an array on *one* log-window line, if you don't
>know in advance the length of the array?
Hi Ted,
The length of any array is a predefined/innate property that you
can simply query with the ".length" modifier. For example, you've built an
array called "BIRD", it goes from BIRD[0] to BIRD[BIRD.length]. So you
really don't need an actual number for the array length, but if you really
want it you also just assign it to a variable, for example:
myarraylength=BIRD.length;
To do what you want to do, you can make a loop that skips through
the array bin by bin, and concatenates all the bins together into a new
variable. Then you can just print that new variable as a single line.
BIRD=newArray("1","56","6342","999");
mystring=BIRD[0];
for (i=1; i<BIRD.length; i++) {
mystring=mystring+"-----"+BIRD[i];
};
print(mystring);
Mark