[SOLVED] Concatenate Array

Hello everyone.

I have a little problem with my coding. I've managed to read the axis from an accelerometer. I'd like to have the values printed in the serial port in the following form "x axis, y axis, z axis". At the moment it's printing the values of the 3 axis continuosly. I'm sure I'm missing something in coding.

#include <Wire.h>
#include <LSM303.h>

LSM303 compass;

int x [1000];

int y [1000];

int z [1000];

char report[80];

void setup()
{
  Serial.begin(9600);
  Wire.begin();
  compass.init();
  compass.enableDefault();
}

void loop()
{
  int i;
  
 for (i=0; i<1000; i = i + 1){
 
 compass.read();
 
 x[i] = compass.a.x;
 
 y[i] = compass.a.y;
 
 z[i] = compass.a.z;

}  


 for (i=0; i<1000; i = i + 1){    
  Serial.println(x[i]); 
  Serial.println(y[i]); 
  Serial.println(z[i]);
 }
  delay(10000);
}

As it can be seen, I've made 3 different arrays that read 1000 values from the different axis of the accelerometer and I've tried to print the results onto the serial. The datas are in ASCII characters.

Thanks on advance of any help.

for (i=0; i<1000; i = i + 1){    
  Serial.print(x[i]); 
  Serial.print(",");
  Serial.print(y[i]); 
  Serial.print(",");
  Serial.println(z[i]);
 }

I've made 3 different arrays that read 1000 values

Let's hope you've got a Mega.

Thank you very much for your help, it works perfectly.

And yes, I have an Arduino Mega board.