10-09-2012 07:09 PM
I would like to write my data to a file but am having trouble approaching the problem. In the file I would like to write both the x and y values of my data points in two columns, however, the y data is in an array and the x data is made up of 3 pieces of information: an initial x, an x incremented value, and the number of points in my data sample. How could I go about this?
Solved! Go to Solution.
10-09-2012 07:40 PM
Would it be best to create an array of the x values by
[x, x+delta_x, x+ 2delta_x ..... , x+(n-1)delta_x]
where n= to the number of dimensions in the array
and then build a two dimensional array of both the x and y values?
10-10-2012 12:50 AM - edited 10-10-2012 12:53 AM
Hello
you could do the way you suggested.
Use a For loop, connect your 'number of samples' to N count, build an array [of x+(n-1)delta_x]. Use 'i' iteration number as your (n-1)
Build a 2D array, of x array and y array.
Then, if you are writing to a spreasheet file, wire the 2D array directly. If you are writing to a text file, use the Array to Spreasheet string and write to the text file
Edit: Note that n is not the number of dimensions, its number of elements in a 1D array
10-10-2012 12:58 AM
@Freelance_LV wrote:
Hello
you could do the way you suggested.
Use a For loop, connect your 'number of samples' to N count, build an array [of x+(n-1)delta_x]. Use 'i' iteration number as your (n-1)
Another option for this is to use the ramp pattern.vi which will do it for you and eliminate the need for you to code up the incrementing inside a for loop
10-10-2012 12:59 AM - edited 10-10-2012 01:00 AM
The number of points is redundant, because it will be the same as the "other" array.
Here's what I usually do:
10-10-2012 06:20 PM
Thanks everyone, it's looking great now!