11-09-2013 09:50 PM
I do not have the Mathscript module, so using it is not an option for me.
In general I would say that the appropriate times to use it are when you have existing Matlab code which is proven to work, is complicated or lengthy, is not too likely to be changed, or which implements functions not readily available in LV. Where the trade-off points are in any project will depend on your relative experience with the two programming environments as well.
When converting code between the two languages, keep in mind that LV starts array indexes at 0 while Matlab starts at 1 (I think).
Lynn
11-10-2013 12:55 AM
Thank for the tip. I have a little bit of problem on the saving, if I use write to waveform and set append = True. The file gets bigger but when I retreive it, it only return 1 second of data.
My loggic is that I use the queue store and retrieve the data, even only 1 element in queue get enqueue each loop- should I be able save all of the information?
11-10-2013 12:08 PM
There is a subtle effect in the Write Waveform to File.vi Read Waveform from File.vi. They write "records" which consist of an array of waveforms. Each time called one record is written or read. So, to get all the data, you need to read multiple times. The detailed help does describe this but it is not so obvious.
Look at the attached test Read VI. It reads successive records until Error 4, End of File encountered occurs.
Also, the VI I posted yesterday will not stop properly because I did not wire the queue reference through the Stop event case. ( I wish tunnels on the event structure did not default to Use Default if Unwired!). The attached version is cleaner.
Lynn
11-10-2013 03:54 PM
johnsold,
I appreciate all the help. If you don't mind if I ask you one more quewstion. there is a thing that is not very clear. Instead of saving the waveform into 1 waveform. Each loop acctually save the data into another waveform - if there is N time of loops, then there is an N waveforms (to compare with 1 waveform with N*duration of 1 loop).The read waveform vi does return a multiple of waveform not a single waveform.
In order to get a 1 waveform, I need to read each waveform in saved file and then combine all saved waveform togther into 1 sinlge long duration waveform?
11-11-2013 07:32 AM
That is correct. Be careful when you do this to ensure your data is actually contiguous (does not have time gaps). The waveform concatenation VI should give you an error if you do.
11-11-2013 08:48 AM - edited 11-11-2013 08:50 AM
thank you both.
😛 that why I only saw 1 second of the data while still seeing the file size get bigger.
Can you tell me what is the technique (function) to ensure there is no gap?
11-11-2013 10:16 AM
If you are streaming data from a continuous generation to the LVM file, you should be fine. If you are taking non-continuous data sets and streaming those to the LVM file, your data is not continuous.
Under the hood, the concatenation routines check the t0, dt, and number of points and confirm that the first point of the second waveform is at the correct time position based on the timing of the first waveform. t0 and dt of both waveforms also need to be equal. Note that "equal" is fuzzy to account for rounding errors saving data to disk and restoring it.