Exemplo n.º 1
0
        private void addVectorButton_Click(object sender, EventArgs e)
        {
            descriptionLabel.Text = string.Format("Based on the selected dimension, 2 one-dimensional arrays are created, then summed.");
            resultTextBox1.Text   = string.Empty;
            resultTextBox2.Text   = string.Empty;
            resultTextBox3.Text   = string.Empty;

            var formHelper = new FormHelper();
            int dim;

            if (!int.TryParse(dimTextBox.Text.Trim(), out dim))
            {
                return;
            }

            var num1 = formHelper.GeneratedRandomVector(dim);
            var num2 = formHelper.GeneratedRandomVector(dim);

            resultTextBox1.Text = string.Format("Vector 1:\n{0}", formHelper.FormatVector(num1, 10));
            resultTextBox2.Text = string.Format("Vector 2:\n{0}", formHelper.FormatVector(num2, 10));

            var result = _simpleMatlab.AddVectors(num1, num2);

            resultTextBox3.Text = string.Format("Result Vector:\n {0}", formHelper.FormatVector(result, 10));
        }