




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、Lesson 6File I/O TechniquesFile FormatsBinary FilesTDMS FilesA. File FormatsAt their lowest level, all files written to your computers hard drive are a series of bits2BinaryTDMSASCIIA. File FormatsASCIITDMSDirect BinaryNumeric PrecisionGoodBestBestShare data Best (Any program easily)Better (NI Progr
2、ams easily)Good (only with detailed metadata)EfficiencyGoodBestBestIdeal UseShare data with other programs when file space and numeric precision are not importantShare data with programs when storing simple array data and metadataStore numeric data compactly with ability to random access B. Binary F
3、ilesUse Binary File functions to interact directly with a binary file4B. Binary FilesBits/Bytes?A bit is a single binary valueEach bit is either on or off and is represented by a 1 or a 0A byte is a series of 8 bits0bit00000000byte5B. Binary FilesStoring Boolean ValuesLabVIEW represents Boolean valu
4、es as 8-bit values in a binary fileEight zeroes represents False 00000000Any other value represents True00000001, 01000110, 11111111, and so onFiles are divided into byte-sized chunks, making them much easier to read and process6B. Binary FilesStoring Boolean ValuesFile ContentsMethod A00000001 0000
5、0001 00000000 00000001 00000000 00000001Method B001010117B. Binary FilesStoring IntegersBinary ValueU8 Value000000000000000011000000102111111112558B. Binary FilesStoring IntegersMulti-byte integers are broken into separate bytes and are stored in files in either little-endian or big-endian byte orde
6、rUsing the Write to Binary File function, you can choose whether you store your data in little-endian or big-endian format9U32 ValueLittle-endian ValueBig-endian Value1000000010000000000000000 0000000000000000 0000000000000000 00000001B. Binary FilesStoring Other Data TypesStrings are stored as a se
7、ries of unsigned 8-bit integers, each of which has a value in the ASCII Character Code Equivalents TableThis means that no difference exists between writing strings with the Binary File Functions and writing them with the Text File FunctionsClusters are best represented in binary files by using Data
8、log Files10B. Binary FilesStoring ArraysArrays are represented as a sequential list of the elementsElement representation depends upon the element typeA header contains a 32-bit integer representing the size of each dimensionExample A 2D array with a header contains: row integer, column integer, the
9、n array data11B. Binary FilesSequential/Random AccessTwo methods of accessing data: Sequential AccessRead each item in order, starting at the beginning of a fileRandom AccessAccess data at an arbitrary point within the file12B. Binary FilesSequential AccessTo sequentially access all of the data in a
10、 file, you can call the Get File Size function and use the result to calculate the number of items in the file, based upon the size of each item and the layout of the fileYou can then wire the number of items to the count terminal of the Read from Binary File function13B. Binary FilesRandom AccessUs
11、e the Set File Position function to set the read offset to the point in the file you want to begin readingThe offset is in bytes; therefore, you must calculate the offset based upon the layout of the file14B. Binary FilesDatalogDatalog is a specific type of binary file, designed for storing a list o
12、f records to a fileEach record is represented by a cluster and can contain multiple pieces of data with any data type15B. Binary FilesDatalog Random Access16Exercise 6-1Bitmap File Writer VIUse Binary File I/O to write a file with a specified format.17Exercise 6-1Bitmap File Writer VIWould the gener
13、ated bitmap file still be correct if you swapped the BITMAPFILEHEADER VI and the BITMAPINFOHEADER VI? Why?It was not necessary to specify the byte-order in the Write to Binary File functions. Why not?C. TDMS FilesTDMSTechnical Data Management StreamingUse TDMS files for the following purposes: To st
14、ore test or measurement dataTo create a structure for grouping your dataTo store information about your dataTo read and write data at high speeds19C. TDMS FilesFile FormatTDMS fileBinary file (.tdms) that contains data and stores properties about the dataTDMS_Index fileBinary index file (*.tdms_inde
15、x) that provides consolidated information on all the attributes and pointers in the TDMS file Speeds up access to the data while readingAutomatically regenerated if lostTDMS file format internal structure is publicly documented20C. TDMS FilesData HierarchyChannel Stores measurement signals or raw da
16、ta in a TDMS fileEach channel can have properties describing the dataThe data stored in the signal is stored as binary data on disk to conserve disk space and improve efficiencyChannel GroupSegment of a TDMS file that contains properties and one or more channelsUse channel groups to organize your da
17、ta and to store information that applies to multiple channels21C. TDMS FilesAccessing TDMS FilesUse the Write to Measurement File and Read from Measurement File Express VIs Allows you to quickly save and retrieve data from TDMS format Very little control over your data grouping and propertiesUse the
18、 TDM Streaming APISet of functions for opening, writing to, reading from, and closing TDMS filesAllows you to organize your data into channel groups and channelsUse the TDM Excel Add-In ToolAllows you to read TDMS files in Microsoft Excel22C. TDMS FilesTDM Streaming API 23C. TDMS FilesWrite DataStre
19、ams data to the specified TDMS fileData subset to write is determined by group name and channel name(s) inputs24C. TDMS FilesRead DataReads the specified TDMS file and returns data from the specified channel and/or channel group25C. TDMS FilesSet PropertiesSets the properties of the TDMS file, chann
20、el group, or channel26C. TDMS FilesGet PropertiesReturns the properties of the TDMS file, channel group, or channel27C. TDMS FilesFile ViewerOpens TDMS file and presents the file data in the TDMS File Viewer dialog box28C. TDMS FilesTDM Excel Add-In ToolExercise 6-2Read TDMS FilesLearn how to read d
21、ata from a TDMS file.30Exercise 6-2Read TDMS FilesHow difficult would it be to implement the logger and reader using ASCII files? Custom Binary files?SummaryQuizYou need to store test results and organize the data into descriptive groups. In the future, you need to efficiently view the test results
22、by group. Which file storage format should you use?Tab-delimited ASCIICustom binary formatTDMSDatalog32SummaryQuiz AnswerYou need to store test results and organize the data into descriptive groups. In the future, you need to efficiently view the test results by group. Which file storage format shou
23、ld you use?Tab-delimited ASCIICustom binary formatTDMSDatalog33SummaryQuizYou need to write a program which saves Portable Network Graphics (PNG) image files. Which file storage method should you use?Storage file VIsBinary file functionsASCII file VIsDatalog file VIs34SummaryQuiz AnswerYou need to w
24、rite a program which saves Portable Network Graphics (PNG) image files. Which file storage method should you use?Storage file VIsBinary file functionsASCII file VIsDatalog file VIs35SummaryQuizYou need to store data that other engineers will later analyze with Microsoft Excel. Which file storage format should you use?Tab-delimited ASCIICustom binary formatTDMSDatalog36SummaryQuiz AnswerYou need to store data that other engineers will later analyze with Microsoft Excel. Which file storage format should you use?Tab-delimited ASCIICustom binary formatTDMSDatalog37SummaryQuiz00
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 請示整改報(bào)告范文
- HCIA路由交換技術(shù)實(shí)戰(zhàn)(微課版)-課后習(xí)題答案
- 二零二五年度正規(guī)欠款合同范本:商業(yè)保理業(yè)務(wù)合作協(xié)議
- 二零二五養(yǎng)老院院民文化參觀出行合作協(xié)議
- 二零二五年度高端定制門安裝與設(shè)計(jì)合同
- 二零二五年度電梯維保服務(wù)與智能化升級合同范本
- 二零二五年度企業(yè)ERP系統(tǒng)采購合作協(xié)議
- MySQL教程(新體系-綜合應(yīng)用實(shí)例視頻)(第4版)習(xí)題及答案 -第08章
- 二零二五年度教育行業(yè)年合同制工人養(yǎng)老保險(xiǎn)合同
- 二零二五年度健康養(yǎng)老項(xiàng)目終止合作框架協(xié)議
- (正式版)HG∕T 21633-2024 玻璃鋼管和管件選用規(guī)定
- 便與健康課件
- 自然辯證法概論課件:第二章馬克思主義科學(xué)技術(shù)觀
- “供應(yīng)商融資安排”會計(jì)列報(bào)、披露問題研究
- 氣道廓清技術(shù)及護(hù)理課件
- 中國黃金集團(tuán)公司黃金工業(yè)項(xiàng)目初步設(shè)計(jì)
- 中醫(yī)院新技術(shù)、新項(xiàng)目申請表、審批表及年季度工作報(bào)告表范本
- 《現(xiàn)代漢語語法》PPT課件(完整版)
- SAP培訓(xùn)講義(FICO概覽)V3-中石油
- 全國江蘇小學(xué)科學(xué)學(xué)科教師基本功大賽試題匯總(共19頁)
- 幕墻工程施工質(zhì)量通病和防治措施方案
評論
0/150
提交評論