07-08-2009 01:43 PM
Hello every one!
I've got quite depressing problem wich harm my mind... fore some days. I have a VI with while loop witch is part of bigger project ... my aim is to collect data and write them to file after 1000 while loop activities... be more precise- after while loop makes 1000 moves I want to write in file the move number (in attachment picture "Number") and value ("array") result should be some kind of array (2columns by 1000 lines).... I can not make one more while loop ower all the VI because it enables the other VI's to work... Can you suggest me sommething?
Solved! Go to Solution.
07-08-2009 01:50 PM
Hi ku ku,
you should use more shift registers and less local variables. Is this the while loop which counts the 1000 iterations?
Mike
07-08-2009 01:52 PM - edited 07-08-2009 01:54 PM
by while loop activities do you mean iterations?
because if that's the case you can wire the while loop iteration icon up to and equals vi and connect that to a case structure...Inside the case structure you can than put your write to spreadsheet and collect the data.
and stacked sequences are kindof frowned upon here:)
07-08-2009 02:02 PM
I don't see why you can't just write as the data is acquired - a single line at a time. Building an array with a shift register would work as well but it depends if you want to have a short delay in the loop to write a single line or a much longer delay every 1000 iterations.
p.s. I hope that True constant wired to the loop termination terminal is just something you did for this example. With that constant, your loop can only iterate one time and saying you want to do a save after 1000 runs is silly.
07-08-2009 02:15 PM - edited 07-08-2009 02:16 PM
Another idea:
Setup two loops - An acquisition loop and a storage loop. Put the data in a shared queue so that the acquisition loops pushes data onto the queue and the storage loop pops data off the queue as it is saved. This may not be necessary if the acquisition is slow, but it is scalable if you start running a higher acquisition rates.
Here is a very simple example.
07-09-2009 01:56 AM
.........by while loop activities do you mean iterations?.......
yes that is wright I couldn't find the wright expressin in the late night.
ok I'll try to write to spreadsheet line by line.... i'll check up is it posible to add to an existing spradsheet file a line of data for 1000 times after each loop iteration.... it could be more reliable because each loop iteration is trigered once in a 30min, and if PC loses power I'm loosing all data.
Thank you very much for ideas!!!
07-09-2009 04:25 AM
now ewerything works fine ... I used the write to spredsheet VI and wrote line by line in file.... why I couldnt figure it out last night.... khhhhh?
thank you everyone for realy operative support!!!