ocaccy
asked on
C# - On int myArray[] = new int[320]; filled to the row 129
How to get filled row, add more one, fill the array in empty position, and the other arrays connected to it in the same nember rows?
ASKER
I know this kaufmed, but the system is get data from serial port and putting in the next row in array.
I am receiving data from serial port.
After the trim (), substring () or split (), we send this data to arrays.
I have an array index to an array for the date and time, and six arrays for each device.
I need the values ¿¿of each device in the correct locations in the arrays.
In the next part of the work, I will use the data from these arrays to the first 8 equations and launch other arrays,
Hence it must come at the right place, not to have problems with the data in front.
I am receiving data from serial port.
After the trim (), substring () or split (), we send this data to arrays.
I have an array index to an array for the date and time, and six arrays for each device.
I need the values ¿¿of each device in the correct locations in the arrays.
In the next part of the work, I will use the data from these arrays to the first 8 equations and launch other arrays,
Hence it must come at the right place, not to have problems with the data in front.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I´m using C#!
public double[] a_d_index = new double[240];
ASKER
Kaufmed, this problem is solved.
I created a variable:
int i_C_AR = Convert.ToInt32(lbl_contad or.Text);
every access the serial port 1 increment "i_C_AR ++"
then:
a_i_sagyou0[i_C_AR, 0] = Convert.ToDouble(stringOut .Trim().Su bstring(4, 5));
......
so far has not problem, if it goes again I ask.
Best Regards,
ocaccy
I created a variable:
int i_C_AR = Convert.ToInt32(lbl_contad
every access the serial port 1 increment "i_C_AR ++"
then:
a_i_sagyou0[i_C_AR, 0] = Convert.ToDouble(stringOut
......
so far has not problem, if it goes again I ask.
Best Regards,
ocaccy
#region Put data in the ARRAYS a_i_sagyou0 ............................................
int i_C_AR = Convert.ToInt32(lbl_contador.Text);
if (stringOut.Trim().Substring(4, 5) != "")
{
a_i_sagyou0[i_C_AR, 0] = Convert.ToDouble(stringOut.Trim().Substring(4, 5));
}
if (stringOut.Trim().Substring(10, 5) != "")
{
a_i_sagyou0[i_C_AR, 1] = Convert.ToDouble(stringOut.Trim().Substring(10, 5));
}
if (stringOut.Trim().Substring(16, 5) != "")
{
a_i_sagyou0[i_C_AR, 2] = Convert.ToDouble(stringOut.Trim().Substring(16, 5));
}
#endregion
ASKER
Thanks, you helped me understand the problem.
This helped me to solve.
Best Regards,
ocaccy
This helped me to solve.
Best Regards,
ocaccy
For an array, the indexes start at zero. Row 129 would be index 128 of the array. To put data in that slot, you would simply do:
Open in new window