03-13-2014 04:07 PM
Hi All,
I have been trying to create new waveforms by the Analog Waveform Editor. I have some waveform generated from MATLAB and saved as ASCII files, following the instruction on this NI webpage, but it didn't work correctly. For example, if I produce a column filling with 0.5, and import the file into the Analog Waveform Generator, all I get is a huge series of random number. Did I miss some steps in importing the waveform?
Thanks!!
Solved! Go to Solution.
03-14-2014 03:40 PM
Hi Boto,
The webpage you linked is actually a KnowledgeBase article that talks about transferring data to LabVIEW Development environment, but this may be different for the NI Analog Waveform Editor.
There are instructions for importing awaveform in the NI Analog Waveform Editor Help file and there also are special considerations for importing ASCII files. Here is the ASCII import excerpt:
ASCII Import Considerations
Would you mind uploading the ASCII file you are testing to the forum?
What version of the NI Analog Waveform Editor are you using?
03-14-2014 07:45 PM
Hi Sam,
Thanks for your reply.
Please see the attachment for one of the the ascii files I was trying to import as tests. I did make the data into a column and there was no header. The file was saved in Matlab using: save(filename,'x','-ascii','-double','-tabs').
I am away from the machine right now so am not sure what version of Analog Waveform Editor it is, but I remember installing it with the DVD/CD that shipped together with NI PXI-5412 and completed some updates afterward. I will let you know the version number tomorrow when I am in the lab again.
Thanks for your help!
Boto
03-17-2014 09:13 AM
Hi again, Sam,
The version of Analog Waveform Editor I am using is 1.2.1.
Thanks,
Boto
03-17-2014 01:31 PM - edited 03-17-2014 01:31 PM
Boto,
When you open AWE 1.2.1, a wizard appears asking if you want to select an existing waveform or a blank waveform. Select Blank Waveform and click OK. Select the desired Sample Rates (S/s) and device you are using then click OK. The select File >> Import, and browse/select your file. Keep the default settings for Delimiter and Decimal Point and clikc OK. I have tried the following on your file that you attached, and it imports without error this way.
Regards,
Jason L.
03-17-2014 01:44 PM
Hi Boto,
I took the same steps as Jason to open the ASCII file in the Analog Waveform Editor (version 1.2.1) and received a period of a triangle waveform (note the timing may be off because I only used the default sample rate):
03-18-2014 04:45 PM
Hi both,
Thanks very much for your help! I followed the same steps as you described and was able to load the waveform without problem. I am not sure what went wrong when I tried last time, but it could be I selected the wrong device.
I have an associated question: In the program, is there a real difference between 1) using the .HWS files generated by the Analog Waveform Editor, and 2) reading in the ascii file using Read From Spreadsheet File.vi and use niFgen Creat Waveform (DBL).vi to create the waveform? Is there any specific advantages in terms of using the HWS file and niFgen Creat Waveform From File (HWS).vi directly?
Thanks again!
Boto
03-18-2014 05:00 PM
Boto,
HWS are heirarchal binary files where as your file is ASCII. Remember, with ASCII you have a binary number that represents a character, so for each character you have in '1.6666666666666666e-04' in your file, you will have a binary number representing the ascii value. A separate binary value will be reperesenting the ascii characters of '1', '.', each '6', 'e', '-', etc.
With a binary file format, you can represent the value of 1.6666666666666666e-04 with much less bits. This means that ascii are going to be easier for a human to read (you can use notepad) but HWS will be easier for a computer to read, because numbers are just saved as 0's and 1's and there is less of a translation for your computer to make to convert each ascii character string into a single number. You (and your computer) can only interpret HWS and other binary formats with existing knowledge of how the 0's and 1's were saved in the file. This API to save and load HWS is built into AWE and the driver already so your computer is going to process HWS files a lot faster and they will have a smaller footprint on your computer's hard drive space.
Regards,
Jason L.
03-18-2014 05:05 PM
Just for your reference, I was able to almost halve the size of your file just by saving it as .hws. Also to address your previous point, you may have issues opening/importing your .txt file because it may have been open in another program at the same time. Make sure you have it closed in notepad or Excel or any other programs that may still be latching onto the reference.
Regards,
Jason L.