Jump to content

write to TXT file


grizzzly

Recommended Posts

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 :blink: ) and not in a format such as mm/dd/yyyy hh:mm:ss. It depends on how you want it formatted.

Link to comment

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 :blink: ) and not in a format such as mm/dd/yyyy hh:mm:ss. It depends on how you want it formatted.

Link to comment

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.

Link to comment

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.

Link to comment

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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.