private void button2_Click(object sender, EventArgs e) //get the value of training set { // Console.WriteLine("Running..."); ExcelEdit ed = new ExcelEdit(); ed.Open("E:\\C#代码\\knnprogram\\result1.xlsx"); //open a excel file Excel.Worksheet worksheet = (Excel.Worksheet)ed.GetSheet("sheet1"); //choose the sheet ed.getTestnum(ed); //get training set data MessageBox.Show("ok!"); temp = 1; }
public Form1() { InitializeComponent(); button1.Enabled = false; ExcelEdit ed = new ExcelEdit(); ed.Open("E:\\C#代码\\knnprogram\\result1.xlsx"); //open a excel file Excel.Worksheet worksheet = (Excel.Worksheet)ed.GetSheet("sheet1"); //choose the sheet ed.getTestnum(ed); len = worksheet.UsedRange.Rows.Count; trainX1 = ed.trainX1; trainX2 = ed.trainX2; trainX3 = ed.trainX3; trainX4 = ed.trainX4; trainX5 = ed.trainX5; trainY1 = ed.trainY1; trainY2 = ed.trainY2; trainY3 = ed.trainY3; button1.Enabled = true; }