LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a loop in which the results are inputed to specific columns

Solved!
Go to solution

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

Download All
0 Kudos
Message 1 of 12
(3,336 Views)

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?

0 Kudos
Message 2 of 12
(3,328 Views)

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.

 

0 Kudos
Message 3 of 12
(3,321 Views)

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.

0 Kudos
Message 4 of 12
(3,306 Views)

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.

0 Kudos
Message 5 of 12
(3,283 Views)

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.

Message 6 of 12
(3,276 Views)
0 Kudos
Message 7 of 12
(3,268 Views)

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?

0 Kudos
Message 8 of 12
(3,264 Views)

I figured out the build path, but the open to new VI I was unsure about.

0 Kudos
Message 9 of 12
(3,257 Views)
Solution
Accepted by topic author duckse2410

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.

Message 10 of 12
(3,251 Views)