LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with debugging

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. 

 

0 Kudos
Message 1 of 10
(2,450 Views)

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)

0 Kudos
Message 2 of 10
(2,434 Views)

My bad. Here you go

Download All
0 Kudos
Message 3 of 10
(2,425 Views)

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?)

 

ECG.png

0 Kudos
Message 4 of 10
(2,404 Views)

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:

check.png

(You data file contains only one row of data, so I'm unsure about the first two lines in your MATLAB code…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 10
(2,403 Views)

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?

0 Kudos
Message 6 of 10
(2,396 Views)

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 :/)

0 Kudos
Message 7 of 10
(2,386 Views)

This is the data file. I attached the wrong file previously, apologies. 

0 Kudos
Message 8 of 10
(2,382 Views)

 (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. 🙂

0 Kudos
Message 9 of 10
(2,375 Views)

Hi hasghar,

 

much better data file now:

check.png

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:

check.png

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 10
(2,357 Views)