|
From: has00536 on 7 May 2008 09:40 Hello, I was wondering ... what is the best way to scan a 2d array of numbers from a text file. An example of such a text file: 0.0000000e+000 3.5000000e+001 3.5100000e+001 3.5200000e+001 3.5300000e+001 3.5400000e+001 3.4000000e+002 -5.4998976e+000 -1.4999700e+000 0.0000000e+000 -1.4999700e+000 2.9999400e+000 3.4066602e+002 -5.5554708e-002 -5.5554708e-002 1.1110942e-001 -4.4444529e-001 1.6666667e-001 3.4133203e+002 -1.2499914e+000 2.2499949e+000 7.5000244e-001 -2.2499826e+000 1.7500051e+000 3.4199805e+002 6.8420986e-001 1.2105260e+000 1.1578951e+000 1.1578951e+000 1.2631568e+000 3.4266406e+002 7.1428082e-001 1.5714212e+000 1.9999914e+000 5.7142626e-001 5.7141972e-001 3.4333008e+002 2.6667133e+000 3.3333832e+000 -1.1753165e-005 -3.3334667e-001 -1.1753165e-005 See also attached file... I tried the "Read from spreadsheet file" but was not successfull. Thanks for the help! John example.txt: http://forums.ni.com/attachments/ni/170/321713/1/example.txt
From: MikeS81 on 7 May 2008 09:40 Hi John, use the "read from text file.vi" and then the "spreadsheet string to array function". Before that replace all "\s\s" to "\s" code display. After that you will have your 2d array of double values. Mike
From: MikeS81 on 7 May 2008 10:10 Hi John, here a picture which shows what i mean. <img src="http://forums.ni.com/attachments/ni/170/321719/1/Unbenannt1.PNG"></a> MikeMessage Edited by MikeS81 on 05-07-2008 03:44 PM Unbenannt1.PNG: http://forums.ni.com/attachments/ni/170/321719/1/Unbenannt1.PNG
From: Dennis Knutson on 7 May 2008 10:10 Read From Spreadsheet will work as long as you specify the correct delimitor. <img src="http://forums.ni.com/attachments/ni/170/321725/1/Read%20From%20file.PNG"> Message Edited by Dennis Knutson on 05-07-2008 07:52 AM Read From file.PNG: http://forums.ni.com/attachments/ni/170/321725/1/Read From file.PNG
From: johnsold on 7 May 2008 10:10 Mike, I did not know you could feed an array of delimiters to the Spreadsheet String to Array function. I could have used that yesterday. Thanks for showing that.Lynn
|
Next
|
Last
Pages: 1 2 Prev: Eval Single -Variable Scalar - formula string syntax Next: Memory cleanup in RT |