grizzzly Posted December 6, 2008 Report Share Posted December 6, 2008 Hello I need to write my signal to TXT file - in one column should be time and in other value ... Every values can rewrite that txt file. I am able to do this m but I have only function value in that file I am not able to write time, How to do this? thanks guys Quote Link to comment
asbo Posted December 9, 2008 Report Share Posted December 9, 2008 In the Timing palette on the Programming palette, you will find a multitude of date/time related nodes. Get Date/Time String is probably what you're looking for. Quote Link to comment
dblk22vball Posted December 9, 2008 Report Share Posted December 9, 2008 The waveform is actually made up of 3 parts: Value, Timestamp and dt. You need to use the Get Waveform components vi to get the value and Timestamp out. Then you can combine those in an array and save it to the file. Also, if you want all of the data points saved to the text document, and not just the current data, you will need to set the Append to File? input to True (default is false). I would also convert the Timestamp and value to strings to save to the text file, otherwise the timestamp will be saved as the time since 1906 (or whatever that date is ) and not in a format such as mm/dd/yyyy hh:mm:ss. It depends on how you want it formatted. Quote Link to comment
grizzzly Posted December 10, 2008 Author Report Share Posted December 10, 2008 Hi thanks for your post, I will try that get waweform component ... But I would like to have in that file not date... but time of simulation..for exemple: 0.1 value( in 0.1 s of simulation) . And these files I am reading in matlab and I would like to build graph from that values so I need time and function value in that time QUOTE (dblk22vball @ Dec 8 2008, 04:27 PM) The waveform is actually made up of 3 parts: Value, Timestamp and dt. You need to use the Get Waveform components vi to get the value and Timestamp out. Then you can combine those in an array and save it to the file.Also, if you want all of the data points saved to the text document, and not just the current data, you will need to set the Append to File? input to True (default is false). I would also convert the Timestamp and value to strings to save to the text file, otherwise the timestamp will be saved as the time since 1906 (or whatever that date is ) and not in a format such as mm/dd/yyyy hh:mm:ss. It depends on how you want it formatted. Quote Link to comment
grizzzly Posted December 10, 2008 Author Report Share Posted December 10, 2008 Hi guys, I found VI that is probably the best for I want to do , it is GET XY VALUE , can somebody please post a VI with exemple how to use it ? and writes these x and y to txt file? I dont know how to do it, I am newbie thanks , I am doing it like this Quote Link to comment
dblk22vball Posted December 10, 2008 Report Share Posted December 10, 2008 Not 100 % on what exactly you are asking for, but here is my interpretation. 1. You have a simulated (or real) waveform and you are looking to save values from it to a file for processing in Matlab. 2. The values that you want to save are: the X and Y values, ie the relative time (x axis) and the amplitude of the signal (y axis). I attached a picture of my interpretation. I am sure there is a more elegant solution, but just what I though of real fast. Basically you pair up the X and Y values of the waveform using the Pair XY values vi, get the dt (time difference between each value), combine them into an array, and then save the data to a text file (last part not shown). Let me know if this is not what you are talking about. Quote Link to comment
grizzzly Posted December 10, 2008 Author Report Share Posted December 10, 2008 Thank you! This is exactly I want to do, maybe I just sometimes not write it exactly because of my english .... I will try this that you posted here, thanks . QUOTE (dblk22vball @ Dec 9 2008, 08:44 PM) Not 100 % on what exactly you are asking for, but here is my interpretation.1. You have a simulated (or real) waveform and you are looking to save values from it to a file for processing in Matlab. 2. The values that you want to save are: the X and Y values, ie the relative time (x axis) and the amplitude of the signal (y axis). I attached a picture of my interpretation. I am sure there is a more elegant solution, but just what I though of real fast. Basically you pair up the X and Y values of the waveform using the Pair XY values vi, get the dt (time difference between each value), combine them into an array, and then save the data to a text file (last part not shown). Let me know if this is not what you are talking about. Quote Link to comment
dblk22vball Posted December 12, 2008 Report Share Posted December 12, 2008 QUOTE (grizzzly @ Dec 9 2008, 01:52 PM) Why did you use for loop structure? I cant find some components of that VI , would you attach that VI? It would be easier for me thanks The For Loop allows you to pair up the dt and Y values quickly and automatically. Check the examples shipped with LabVIEW for more information on the For Loop. Vi is saved in LV 8.5.1 added ver 8.2 as well Quote Link to comment
grizzzly Posted December 13, 2008 Author Report Share Posted December 13, 2008 ... Quote Link to comment
dblk22vball Posted December 13, 2008 Report Share Posted December 13, 2008 Sorry, files must have got mixed up. try this one. Quote Link to comment
grizzzly Posted December 14, 2008 Author Report Share Posted December 14, 2008 . Quote Link to comment
grizzzly Posted December 15, 2008 Author Report Share Posted December 15, 2008 updated version, file is saved every 0.1 seconds. Quote Link to comment
dblk22vball Posted December 16, 2008 Report Share Posted December 16, 2008 Updated the code to save multiple signals to a file. Quote Link to comment
grizzzly Posted December 16, 2008 Author Report Share Posted December 16, 2008 final version Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.