11-26-2012 03:11 AM
Hello All,
I need to know that how can I write a 1D array of double [64-bit real (~15 digit precision)] to a .txt file for post-processing in other tools like Matlab. The .txt file should consist of 1 column only, an example of the required .txt file format is attached.
P.S. The array is too large
Regards
11-26-2012 03:15 AM
You can use the 'write to spreadsheet file' VI which is in the File I/O pallette.
http://zone.ni.com/reference/en-XX/help/371361J-01/glang/write_to_spreadsheet_file/
11-26-2012 03:15 AM
Hi
Use write to spreadsheet vi.
11-26-2012 05:18 AM
Thanks for reply, I already used write to text as well as write to spreadsheet.vi but it gives me a matrix where I need a vector having only one colum and all the data lies sequecially in that column as shown in the test.txt file. Any help in this regard will be appreciated...
Regards
11-26-2012 05:27 AM
Can you post your vi and its output. Not sure what you mean when you say it gives you a matrix.
Ken
11-26-2012 05:27 AM - edited 11-26-2012 05:29 AM
Change the 'Transpose' input on Write to Spreadsheet to true.
11-26-2012 08:05 AM
Hello,
The output of the the array is 1D array of double [64-bit real (~15 digit precision)] and I want to save it as single column .txt file (as shown in the attachement in the first message of this thread) in order to read that .txt file in MATLAB for post-processing.
Using write to spreadsheet or text.vi file give me the .txt file but the data is distributed in more than 1 column where I need all the data to be stored in one column (as vector) so that MATLAB can read the .txt file.
Regards
11-26-2012 08:10 AM
11-26-2012 08:11 AM
You have to post your complete code. The image you updated doesn't show you are writing to a spreadsheet.vi where it will take it without any issue. You are trying to connect the double value to a text input of the file before that you need to convert that to spreadheet string and then write to the text file vi.
11-26-2012 08:13 AM
What is wrong with Phil_'s code? That is exactly what you need.
Your other option would be to use the Array to Spreadsheet String and then write to the text file (which is really what is done inside of the Write to Spreadsheet String).