02-23-2023 03:16 PM - edited 02-23-2023 03:19 PM
My goal is to create a file every whatever time I set (in seconds).
Everything works fine, the problem is just the data structure on my file does not look good. What am I doing wrong? I have attached my vi
P.S.: I would like to use "Write to text file" block. I'm not trying to use a different VI/block such "write delimited spreadsheet"
Solved! Go to Solution.
02-23-2023 03:27 PM
Write the header just once, when you make the file for example.
02-23-2023 03:30 PM
In the VI you attached, you are generating new data ever 1 second and appending it to the end of your 2-D array but you are also writing the entire header + 2-D array to your text file every single iteration.
One way you could fix this would be to write the header when you create the file and then in your write data to file loop only write the array of three random numbers each iteration so you're basically adding a row to your file every iteration.
02-23-2023 04:10 PM
I think I solved the problem.
02-23-2023 06:24 PM
@GRCK5000 wrote:
I think I solved the problem.
Remember this is a forum where people come to get answers. How does your solution help others? Consider that you wouldn't mark a post like that from someone else as the solution.
Would you mark mine as a solution if I merely posted, "Hey I have the solution for you." Of course not.
02-23-2023 11:02 PM
Sorry about that, Billko. You are so right. Not showing others what to do would be very selfish of me. I'm not like that. I love helping and sharing with others because I've been helped so many times as well. So I attached the code.
02-24-2023 12:59 AM
02-25-2023 12:15 AM
Hi GerdW,
I am so used to local variable because I think it's a shortcut. Shift register can be annoying something especially if you have a state machine with multiple states.
02-26-2023 11:43 AM
Hi GRCK,
@GRCK5000 wrote:
I am so used to local variable because I think it's a shortcut
They are no "shortcut". And you should have learned that from all your previous threads…
@GRCK5000 wrote:
Shift register can be annoying something especially if you have a state machine with multiple states.
Why?
02-26-2023 01:13 PM
Thanks GerdW,
I’ve been thinking about staying away from local variables. I noticed it is not as efficient as shift shifters when passing data.
also not as good as queues when passing data between two parallel loops. Local variables have the tendency to lose some data; whereas queues will make sure you get all your data. I definitely should stay away from local variables. I remember being yelled at so many times about avoiding using local variables unnecessarily.