Hello im a newbie having problems.
I have got two arraylist with values in them. I want to subtract each value from the oposite value in the second array list to get a new list C which i am going to plot on a graph. For example
ArrayLists A,B
A - B C
0.564 - 0.356 = 0.??
Im trying to do this for each value in the list.
Any Ideas would be grate full. So far my code is as follows:
using System;
namespace differenceofmeans
{
public class TraceSet
{
public static void Main(string[] args)
{
string file = System.IO.File.ReadAllText(@"C:\Users\40025634\Desktop\Project\TraceSet.csv");
ArrayList rows = new ArrayList(file.Split('\n'));
{
foreach (string row in rows)
{
string r = row.Remove(row.Length - 1, 1);
ArrayList rowVals = new ArrayList(r.Split(','));
float sum = 0;
float addedItems = 0;
foreach (string item in rowVals)
{
try
{
float num = float.Parse(item);
sum += num;
addedItems++;
}
catch (Exception)
{
//throw;
}
}
if (addedItems > 0)
{
float avrg = sum / addedItems;
ArrayList avrgvalues = new ArrayList();
avrgvalues.Add(avrg);
Console.Write(avrg);
}
string filetwo = System.IO.File.ReadAllText(@"C:\Users\40025634\Desktop\Project\SboxOutput.csv");
ArrayList columns = new ArrayList(filetwo.Split('\n'));
{
foreach (string column in columns)
{
string c = column.Remove(column.Length - 1, 1);
ArrayList columnVals = new ArrayList(c.Split(','));
float sumcolumn = 0;
float addedItems1 = 0;
foreach (string item in columnVals)
{
try
{
float num = float.Parse(item);
sumcolumn += num;
addedItems1++;
}
catch (Exception)
{
//throw;
}
}
if (addedItems > 0)
{
float avrg1 = sum / addedItems;
ArrayList avrg1values = new ArrayList();
avrg1values.Add(avrg1);
Console.Write(avrg1);
}
}
Console.ReadKey();
}
}
}
}
}
}