04-13-2009 02:32 PM
HI Nathand and Olivia,
Thanks for your detailed input. The VI posted by Nathand above was identical to the screenshots posted by Olivia, except for one small thing. This is that the pathname attaching to the shift register on the right hand side was attached to the output of the save block (on Nathand's) and bypassed this output on Olivia's. This doesn't appear to make a difference to the way it write to file so thats great. I have set the append to file to "true" and the write header to "false, it seems to work well now. I am currently trying to implement some advice from a separate thread regarding a different way to decimate the data. (http://forums.ni.com/ni/board/message?board.id=170&message.id=401352&jump=true#M401352
One question - does this configuration mean that the file is being opened and close on each iteration of the loop?
Thanks,
Claire.
04-13-2009 03:23 PM
04-13-2009 04:15 PM
Hi Nathand, I've split up the standard Write waveform to spreadsheet VI and put some of it inside the loop and some outside. I've tried to put the "Close" block at the front of the True condition, with the idea that it closes the file before it opens the next one, but this is problematic because (1) in the first loop there is no file open yet and (2) I think it will close the file that was just opening, rather than the one previous. Can you point me in the right direction?
Cheers,
Claire.
04-13-2009 04:34 PM
As for the first point about closing the file on the first loop iteration, I don't think anything will happen, but if it does generate an error, just use the "Not a Number/Path/Refnum?" function in the comparison to check that you have a valid refnum, and only close if the refnum is valid. You should also wire a "Not a refnum" constant to the left side shift register to make sure that the shift register is initialized, and you should close the file outside the while loop as well (when the program ends) on the right side.
For your second point, you're misunderstanding either dataflow programming or shift registers. Think about what value will be on the refnum wire when it flows into the Close function. Despite this, it would be good practice to guarantee that the Close happens before the Open by using the error in and error out terminals to chain the VIs together.
04-13-2009 05:19 PM
Thanks Nathand. Yes I did get errors for the close file on the first pass until I put in the check on the refnum (I think I've implemented what you described). I've added all the other things you said to. I'm not sure if the final Close (outside the loop) should be placed outside the prodcuer loop after the Stop Task, or outside the consumer loop adjacent the refnum shift register?
Thanks for your help, I'm excited to have something that works!
Cheers,
Claire.
03-18-2012 09:20 PM
How to save data from VISA instrument automatically in different files for every iteration of FOR LOOP....?
03-19-2012 04:47 PM
b412,
Try using a Write To Measuremen File VI in the Express Palette. You can wire in the data that you are trying to save to this VI and it will give you several options on how you would like to record it.
03-24-2012 06:29 AM
thank you sir...