05-27-2016 01:41 PM
I'm trying to analyze the beats in an ECG signal acquired through MyDaq, but in order to do that I must have data of specific length so that I can analyze it. For that reason, I've connected the input dynamic data to an array size so that I can see how, with every while loop,the size of the data changes. I want to analyse it once the data every 300 samples. Of course, the thing is that in the next round I don't want to analyze the previous data so I must erase it or something...For that I've thought that I could split the original dynamic data in packages of size 300 and like this in each while pass the data of size 300.
Any idea as to how I can do it? I'm using a random "simulate arbitrary signal" for now.
05-27-2016 02:59 PM
check this vi i tihnk it is what you need
05-27-2016 03:40 PM
It seems good! I'm adapting it to my program now. How can I then, for example, make a LED turn at the end of each cycle of 300 samples? where do I connect the LED?
05-27-2016 03:48 PM
05-27-2016 04:03 PM
Okay, the LED thing works. But now I've tried to introduce a simulate arbitrary signal and the "size" doesn't increase, so the LED doesnt' turn on when it should. Any idea as to why?
05-27-2016 04:13 PM
check this vi if your problem is not fix yest attach your vi please
05-27-2016 04:28 PM
It still doesn't seem to work, though in your signal the LED works fine...Here I send you my signal. I also attach the beat detection program, just so that you understand better what I'm trying to do. Instead of the LED turning on every 300 samples what I intend is for the data to go the matlab script every 300 samples so that I can obtain the heart beat.
05-27-2016 04:30 PM - edited 05-27-2016 04:32 PM
I assume you are trying to do this using an Express VI, perhaps the DAQ Assistant. This has limited functionality -- it can be good for doing simple things, but as your needs become more complex, you may want to learn to use DAQmx directly. Fortunately, this is not too difficult. There is an excellent White Paper written by NI that you can find if you do a Web Search for "Learn 10 Functions in NI-DAQmx" and read the article.
You mention that you want to take 300 samples at a time and do some analysis on them. Have you connected your myDAQ up to your PC and opened MAX (NI's Measurement and Automation eXplorer)? If you do, you can open a Test Panel, choose Analog Input, set the mode to Continuous (means it is always sampling until you tell it to stop), set the rate to whatever you need (if you set it at 50 Hz = 50 samples/second, it will take 6 seconds to collect 300 samples), set Samples to Read to 300, and push Start, you will see it ... collect 300 samples at 50 Hz and update the display every 6 seconds.
The Article tells you how you can "capture" all of these settings (I think I'm remembering this correctly ...) by creating a MAX Task, and can use this Task, along with about 4 or 5 DAQmx functions, to do exactly the same thing in LabVIEW. Every 6 seconds you'll get another 300 points to analyze (until you stop the While loop, of course).
P.S. -- you can turn the LED on when the DAQmx Read function hands you the 300 points, and turn it back off when you finish processing them. Depending on how speedy you are at processing, the LED will be on for varying lengths of time. You could, of course, also turn it on and (using a Sequence and a Wait (ms)) make it go off a second later ...
Bob Schor
05-27-2016 04:40 PM
Yes, that's right, I'll be acquiring the signal by MyDaq. I don't have it with me right now though so I thought I could simulate a ECG and try to do it like this, so that when I have the MyDaq I already have the program ready, so I might try to work out the VI you've sent me with this fake ECG signal. But reading the article, which is very instructive, it might be easier to wait until I can use the MyDaq....
Thank you so much for your help!
05-27-2016 04:41 PM
I think you need to study a bit about labview programing I see your code it is full of thing that you have to correct them
pay attention to what bob told you and study about daqmx i can give you a vi that is what you want exactly
but what you want is not best thing to do
lunching matlab with labview every 200 milliseconds for simple calculation is not reasonable
best regard,
Hatef