How to merge processing code for HMC5583L and MMA7361C

Hi I am using a HMC5583L breakout board along with a logic converter and an MMA7361C breakout board as a magnetometer and accelerometer respectively, connected to an Arduino board. I have already created the labview interface for these 2 sensors to work together. However i have not been able to figure out how to merge the processing code for the 2 sensors to be uploaded into the driver. Any help would be great, please and thank you!

What "processing code" would that be?

@awol Im sorry the attached image seems broken, ill type it out.

For HMC5883L:

#include <Wire.h>
#include <HMC5883L.h>

HMC5883L compass;
int error = 0;

void setup()
{
Serial.begin(9600);
Wire.begin();

compass = HMC5883L();
error = compass.SetScale(1.3);
error = compass.SetMeasurementMode(Measurement_Continuous);
}

void loop()
{
byte inChar;

MagnetometerScaled scaled = compass.ReadScaledAxis();
int Xscaled = scaled.XAxis;
int Yscaled = scaled.YAxis;

if(Serial.available() > 0)
{
inChar = Serial.read();

if(inChar=='A')
{
Serial.flush();
Serial.print("x");
Serial.println(Xscaled);
Serial.print("y");
Serial.println(Yscaled);
}
}
}

For MMA7361C:

int xpin = 1;
int ypin = 2;
int zpin = 3;
int x_unit_raw = 0;
int y_unit_raw = 0;
int z_unit_raw = 0;
int x_unit = 0;
int y_unit = 0;
int z_unit = 0;
long xtot = 0;
long ytot = 0;
long ztot = 0;
int xavg = 0;
int yavg = 0;
int zavg = 0;

void setup()
{
Serial.begin(9600);
analogReference(EXTERNAL);
int loops = 0;
while(loops < 500);
{
int xsample = analogRead(xpin);
int ysample = analogRead(ypin);
xtot = xtot + xsample;
ytot = ytot + ysample;
loops++;
}
xavg = xtot / 500;
yavg = ytot / 500;
zavg = (xavg+yavg)/ 2;
}

void loop()
{
byte inChar;

x_unit_raw = analogRead(xpin);
y_unit_raw = analogRead(ypin);
z_unit_raw = analogRead(zpin);
x_unit = x_unit_raw-xavg;
y_unit = y_unit_raw-yavg;
z_unit = z_unit_raw-zavg;

if(Serial.available() > 0)
{
inChar = Serial.read();
if(inChar=='A')
{
Serial.flush();
Serial.print("x");
Serial.println(x_unit);
Serial.print("y");
Serial.println(y_unit);
Serial.print("z");
Serial.println(z_unit);
}
}
}

See
http://www.thebox.myzen.co.uk/Tutorial/Merging_Code.html

thank you!