Haider,
Writing to a file is on the software side and it might not be able to keep up with the triggering if we tried to tackle this on the software side of things. I would suggest doing some kind of post processing. If you are not using the trigger line for anything else, you should be able to set up a seperate digital/analog task and just monitor the channel. Then you can set up some kind of software logic where, if the signal was zero then you do not save the data otherwise you save the data.
The best way to achieve this would be to use a producer consumer loop and have one loop for acquiring the data and one for all of the analysis and file I/O. There is a template if you click on file >> New >> Template in the LabVIEW environement where you can see the producer consumer loop. You will be using queues to pass the data from the producer loop to the consumer loop.
It would be difficult to implement something like this in hardware because the PFI line is TTL logic.
I have attached and example of a producer consumer loop example. You can utilize this to implement your code.
Hope that helps.
Regards,
Raajit L
National Instruments