

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
A step-by-step labview exercise to write data to a spreadsheet file. It covers opening a blank vi, using the open/create/replace file function, a while loop, write text file function, array to spreadsheet string function, and other related functions. The exercise also includes creating constants, formatting strings, building arrays, generating random numbers, and closing the file.
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!
Exercise 2.4 – Write to Spreadsheet File
1. Open a blank new VI from the Getting Started screen. 2. Place the Open/Create/Replace File function on the block diagram. Right-click on the block diagram to open the functions palette and select File I/O » Open/Create/ Replace File. 3. Right-click the operation terminal of the Open/Create/Replace File function and select Create » Constant from the shortcut menu, and select open or create from the drop down menu. 4. Place a While loop from the Structures palette on the block diagram to the right of the Open/Create/Replace File function. Right-click on the block diagram select Structures » While Loop. 5. Place a Write Text File function inside the While Loop. Right-click on the block diagram select File I/O » Write To Text File. 6. Wire the refnum out terminal from the Open/Create/Replace File function to the file (use dialog) terminal of the Write Text File function. 7. Wire the error out terminal from the Open/Create/Replace File function to the error in terminal of the Write Text File function. 8. Place an Array to Spreadsheet String function inside the while loop and to the left of the on Open/Create/Replace File function. Right-click on the block diagram and select String » Array to Spreadsheet String. 9. Right-click the format string terminal of the Array to Spreadsheet function and select Create » Constant from the shortcut menu and enter “%0.4f” in the string constant to format the input data. 10. Place a Build Array Function on the block diagram. Right-click on the block diagram and select Array » Build Array. 11. Place a Random Number inside the While Loop. Right-click on the block diagram and select Numeric » Random Number (0-1). 12. Wire the error out terminal of the Write Text File function to an output tunnel on the While Loop. 13. Place an Unbundle By Name function inside the While Loop. Right-click on the block diagram to open the functions palette and select Cluster & Variant » Unbundle By Name. 14. Wire the error out from the Write Text File function to the Unbundle By Name function. 15. Place an Or function in the While Loop. Right-click on the block diagram to open the functions palette and select Boolean » Or. 16. Switch to the front panel and place a stop button. Right-Click on the front panel to open the Controls palette and select Boolean » Stop Button. 17. On the block diagram, wire the status element of the error cluster to the x input of the Or function and wire the stop button to the y input. 18. Wire the output of the Or function to the conditional terminal of the While Loop.