04-28-2019 03:07 AM
Hello,
I am a new user for LabView and I have a project I am working on for which we have to select an ECG record file in the .txt format and use matlab script to figure out the number of peaks. I have been trying to run this code but I realized that I am getting zero as my output everytime because it is not reading my input. If someone can help me out, I'd appreciate it.
04-28-2019 04:08 AM
Attach the VI instead. Also include a data file.
(A code picture is useless because you have hidden and backwards wires and no labels in the diagram constants, so we cannot tell how things are connected)
04-28-2019 06:48 AM
My bad. Here you go
04-28-2019 11:12 AM
Your file only has one row, so just read it with all defaults (no need to wire all these constants if they are at the defaults) and get the first row as follows:
(I don't have Matlab here, so restore the rest of the code as needed. I am sure you could do the analysis directly in LabVIEW, though. Have you tried?)
04-28-2019 11:13 AM - edited 04-28-2019 11:14 AM
Hi hasghar,
I tried to replicate your MATLAB code by pure LabVIEW as best as I could (but still quick&dirty), but I'm no expert in MATLAB:
(You data file contains only one row of data, so I'm unsure about the first two lines in your MATLAB code…)
04-28-2019 11:17 AM
Also note that your data has no timing information, so in order to get real units, you need to know the sampling rate independently. Do you?
04-28-2019 12:10 PM - edited 04-28-2019 12:13 PM
The project actually requires me to do the analysis with Matlab, hence I have to do it with that instead of using LabView functions. The first column in the record file is the sampling time. I am confused as to why it's not pulling that information. If I can get it to pull that, then my Matlab code should work fine.
(Still new to LabView so I apologize if I'm not understanding things right away :/)
04-28-2019 12:16 PM
This is the data file. I attached the wrong file previously, apologies.
04-28-2019 01:16 PM
(I won't be near a computer for the rest of the day. Cannot look at your new file)
Sorry, I don't understand the Matlab requirement. Seems completely pointless. If you want to do Matlab, also use it to read the file. 🙂
04-29-2019 12:46 AM - edited 04-29-2019 12:53 AM
Hi hasghar,
much better data file now:
Now you can do your analysis using MATLAB…
Why do you ask MATLAB questions in a LabVIEW board, when you don't like LabVIEW answers?
Your simple peak detection algorithm is pretty senseless with your noisy data. This is the easy LabVIEW way: