LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Averaging N amount of waveforms to get a resultant waveform

Hello im trying to calculate an average for the selected section of the waveform, N amount of times to get an overall averaged waveform. however at the moment when i select a section of the waveform only the average of that waveform gets displayed. the goal is to add up all the selected waveforms and display and averaged waveform.

Thanks in advance 

Download All
0 Kudos
Message 1 of 8
(3,106 Views)

There is no waveform data, just a 2D array. Currently you are selecting one column and limiting the averaging of that column between the two cursors. Do you simply want to do the same on the average of all columns or something else?

 

A lot of your code does not make a lot of sense though and could be simplified. Some things are plain wrong, for example you could combine the two property nodes. These operate top to bottom, so you need to set the active cursor before taking the position and not the other way around. It is also safe to say that using "read delimited spreadsheet" is NOT the correct tool for the attached tdms file.

Message 2 of 8
(3,094 Views)

i apologise i put in the old VI, i have attached the new VI which can read TDMS files and turn them into a 2D array. in regards to the active cursors im not too sure what you mean. 

FYI i am very new to LABVIEW and not to good with the software, hope you can help 

thanks in advance 

Download All
0 Kudos
Message 3 of 8
(3,085 Views)

@da325 wrote:

in regards to the active cursors im not too sure what you mean. 

 


Property nodes operate top to bottom, so if you read the cursor position before setting the active cursor, you are reading the position of whatever the currently active cursor was, which might be unpredictable.

 

It is also better to read the cursor index, which gives you directly the right index value of the array elements (but the cursors need to be locked to a plot).

 

You also probably want to insert a "Max&Min" to make sure the indices are sorted.

 

cursors.png

 

I'll have a look at the code later.

Message 4 of 8
(3,074 Views)

Hi altenbach, i just wanna say thank you for taking the time to help. I tried what you told me to do but i think my explanation wasn't too good. basically i want to load the acquired waveform data into the "Raw Data Input" graph,  from here i want to select certain segments of the waveform and display the selected segment into the "Data Section" graph. if i decide to log this data then it should be displayed on the "current Data" graph and each time i select a different segment of the graph and log it it should add up and present and average waveform. the reason i'm doing this is because i'm currently working on a project which involves controlling a wheelchair with EOG signals. so to do the calibration i need the user to look either each direction, x amount of times so i can get an average of the signal and from there calculate a threshold value. i far from finished and like i said before i'm very inexperienced with LABVIEW. I really appreciate your time and patience, your advice has really helped me greatly. i have attached my full project up to date just so that you can get an idea of what i'm working on.

p.s its far from finished

0 Kudos
Message 5 of 8
(3,056 Views)

Well, the Good News is you now have responses from at least two LabVIEW Users who know about Eye Movements (and know where to put the electrodes for an EOG).  You seem to have done a reasonable job of copy-and-pasting from LabVIEW Examples, and have tried to build your code "from the bottom up".  While the DAQmx part (from the Example) looks reasonable at first glance, you then throw in an Express VI for your Filter, add that awful construct, the Dynamic Data Wire, then strip off the Time information inherent in the Waveform coming out of the DAQmx Read.

 

Fortunately, you are "near the beginning", so saying "Start over" isn't as bad as if you had a 4-screen VI with hundreds of wires running all over the place.  Here's what I recommend:

  • Get Pencil and Paper (or your Favorite Word-Processor, which is what I use) and write a paragraph or two saying as clearly as you can what you want to do.  Do not be concerned at all about "how" to do it, just concentrate on the "what".
  • Try initially to think at a higher, more abstract level -- avoid the temptation to dive into the details, which gets you away from "what" and into "how".
  • What you hopefully will realize is that you have a series of "tasks" that you need to run in a particular order, perhaps with some looping, or some branching.
  • Often when you structure things in this (abstract) manner, a design model like a State Machine or a Queued Message Handler suggests itself.
  • Don't worry too much about data -- this can be "abstracted" as well.
  • Once you have a set of (independent, sequential) Tasks, start thinking how you would write them as a (single, or a few) LabVIEW VI(s).  Nothing "encapsulates" a Task like putting it into a sub-VI.
  • If done correctly, you should have a fairly simple Top Level VI that (a) handles a (relatively-simple) Front Panel, (b) implements a Design Pattern like a State Machine to handle the sequence of Tasks you have outlined, and (c) fits easily on a single Laptop Screen.  [Why is this important?  If you can see everything "at a glance", it is much easier to understand function and spot bug.  Note that you'll be seeing a few (4-8) subVI, hopefully with meaningful Icons created by LabVIEW Icon Editor, and can say "Oh, that makes sense ...".

Bob Schor

Message 6 of 8
(3,037 Views)

Sorry, I was away from the computer.

 

First things first: In your first small FOR loop, you need to either initialize the shift, or even simpler, just autoindex at the output tunnel. No shift register needed (See picture).

 

gettdmsdata.png

 

Also, the entire code seems inside/out. You should have an outer while loop and no inner while loops and a state variable that selects the current state based on the tab, for example.

 

I still don't understand what you want, for example if you would move the cursors between log clicks, you would get a misalignment in the data. Or do you want to sum the entire row/column instead?

 

Message 7 of 8
(3,037 Views)

It looks like da325 is struggling to read out all 1d-array data from the .tdms file, which works like this:

open_tdms.png

 

 

 

Message 8 of 8
(3,017 Views)