10-06-2014 07:44 PM
Hi,
I am trying to create a loop so that my data from three columns after being calculated will be reconverted into three columns again and then run through 10 seperate data text files to add to the new file so that when the loop is finished I have 3 columns with data from all 10 files. I.E. I have three data points A,B,C from file 1 in column 0,1,2 and then when I run file 2, the three new data points 2A,2B,2C will go underneath their respective column. Right now it is just erasing the pervious trial. Any help would be appreciated it, I am very unfamiliar with loops and I am just geting started
Solved! Go to Solution.
10-06-2014 08:01 PM
I want to clarify the problem. The designed purpose of the program is:
Read 10 data files.
Sort the data from those 10 files into a single data structure
Are you wanting the min and max to be from EACH iteration or do you want it to be a single max and min from the ENTIRE data set?
As the code is written right now, the loop isn't really your problem. It's more related to how you're computing the data.
Are you intentionally requiring the user to choose the file each time or did you want to automate this?
Do you want the user to have to determine how many times to iterate the for loop each time or what are you wanting to determine how many times to run through the loop?
10-06-2014 08:10 PM
Read the 10 data files and I want to sort the data from the 10 files in to a structure, and I want the range of motion of each case which is where I use min and max. Ok I am guessing that I am struggling with computing then. I want to automate it but I am not sure houw to do it. I want the user to determine how many times to run through the loop.
10-06-2014 08:25 PM - edited 10-06-2014 08:26 PM
Think of loops as "inside/outside" If you want something to be done lots of times, it goes inside the loop. If you only want it to happen once, it goes outside. We want to calculate the range of motion once, right? So we should pull that outside of the loop and calculate it after we've built the data structure.
For now, let's do things one at a time. We can work to automate the filenames later. For now, we know we want to build a larger array than what we have. I attached a VI that builds a data structure. I want you to take a look at it and try to understand it. Once you understand it, you should be able to implement it into the rest of your code.
Edit: It's in 2013. If you need it saved as an older version, let me know what you are running.
10-06-2014 10:26 PM
I don't know if this is exactly what you were looking for, but I simplified it and got the loop to work. It's more of a matter of making it automatic now.
10-06-2014 10:40 PM
What I'm looking for shouldn't matter. It's your program 😃
If you want to automate it, start by using build path to open one VI. After you understand that, we can look at cancatenate string and use that to modify the path in each iteration to open similarly named VIs automatically.
10-06-2014 10:56 PM
10-06-2014 11:03 PM
Munna, it's the same project but the idea in it changed. When the idea changed, he made a new thread. Does it bother you to solve different problems in different threads?
10-06-2014 11:25 PM
I figured out the build path, but the open to new VI I was unsure about.
10-06-2014 11:34 PM
If the files are named like what you attached here:
Use a shift register to keep a number saved between iterations. Increment it in each iteration.
Number to decimal string turns it into a string. Concatenate strings lets you add that to the file path for each iteration.