10-18-2019 04:05 PM
I have attached the vi I have designed for a simple sinusoidal wave. I am saving the whole waveform data into a spreadsheet file but what I also want to do is save in a one-column file only the amplitude values of the signal. With the current design only the last amplitude value is saved. How is it possible to achieve what I am trying ?
Solved! Go to Solution.
10-18-2019 04:25 PM
A few comments.
1. Your VI only runs once. You can't to anything repeatedly because there is no while loop around it.
2. You have a race condition because the local variable of Sine Input is probably read before the value gets entered into the terminal for Sine Input.
3. You are generating a waveform, but it is being coerced into a scalar value with the "Sine Input" terminal. Off hand I don't know if that is the first value or last value of the waveform.
4. I don't see anywhere that you are calculating an amplitude. Actually, you are creating a sine wave that is based on a control you call amplitude. So if you want to save the amplitude to the file, just directly wire the Amplitude control to the Save Delimited File function.
5. Are you actually trying to save the entire waveform for the file? You seem to be doing that already with the Export Waveform to Spreadsheet File function near the top.
Please explain what you expect to get in your file.
10-18-2019 04:36 PM
Yes, I am exporting the waveform to a file. This is done perfectly. What I want to is to store in a file only the values of the sine function for each value of time t. The amplitude control only sets the the maximum and minimum peak values like [-1,1] or [-30,30].
10-19-2019 10:05 AM - edited 10-19-2019 10:06 AM
Use "Get Waveform Components" to get the Y array out of the waveform. Wire that to Write Delimited File. Use a linefeed character as the delimiter.
10-19-2019 12:11 PM - edited 10-19-2019 12:12 PM
Only thing I changed in order for the vi to work properly is that I substitute the newline delimiter '\n' with the 'Carriage Return Function' from the 'String Palette'. It also works properly if I use the 'End of Line Function' from the 'String Palette'. Anyway, thank you very much for your help.
10-19-2019 12:43 PM
@teoprot wrote:
Only thing I changed in order for the vi to work properly is that I substitute the newline delimiter '\n' with the 'Carriage Return Function' from the 'String Palette'. It also works properly if I use the 'End of Line Function' from the 'String Palette'. Anyway, thank you very much for your help.
It all depends on what you are doing with the file after you create it. Many things don't care if it a carriage return or linefeed. If your use does care, then of course change it to carriage return. Some situations require a carriage return AND a linefeed.