How to detect points on an electrogram based on voltage window?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I need to detect specific points on an electrogram based on a voltage window. These points will be on the boundaries of the window, but one will be located at the QR interval side and the other after the S peak close to the baseline. I've already detected the R and S peaks using findpeaks, if that's helpful. The following is the code I have so far:
Qstart =[];
Send =[];
xfbB = fliplr(xfb); % flip xfb array
k = pks3:length(xfbB);
for i = 1:numel(locs_RwaveB) %find the point which is the start of QRS
xfbB1 = 7*10^7;
if k <= pks3(i) && k>xfbB1
xk = find(xfbB1(k) == xfbB1);
end
Qstart(:,i) = Qstart(xk);
end
for ii = 1:numel(locs_SwaveB) %find the point which is the end of QRS
xfb2 = 6*10^7;
for h = pks4:length(EGM_invertedB)
xh = find(EGM_invertedB(h) == xfb2);
Send(:,ii) = Send(xh);
end
end
QRS = Qstart(i) - Send(ii);
But either I get the following error message: Operands to the and && operators must be convertible to logical scalar values. Error in peak2peak_detection_updated (line 89) if k <= pks3(i) && k>xfbB1
or that index exceeds matrix dimensions regarding the line "QRS = Qstart(i) - Send(ii);"
Could you give me any advice please? Thanks.
0 Commenti
Risposte (1)
Matt Cohen
il 17 Mag 2016
Hi Konstantinos,
I understand you are trying to detect boundary points of a voltage window and are receiving some error messages in your code.
Without having the data or a background understanding of the task you are trying to accomplish, it is hard to say for sure what will cause errors in the code. However, in terms of the first error mentioned ("Operands to the and && operators must be convertible to logical scalar values"), this appears to occur because each expression in the AND-operation returns an array instead of a scalar logical result. The documentation for the short-circuit AND operator (&&) states that each expression must evaluate to a scalar logical result. Since the variable 'k' in your code is an array, each expression of "if k < = pks3(i) && k>xfbB1" will return a logical array. You might want to use something like the "any" function to determine if any of the elements of 'k' satisfy the expression conditions. This will produce a scalar value for each expression instead of an array for each.
As for the "Index exceeds matrix dimensions" error, you should check the values of variables 'i' and 'ii' to make sure they are not too large for indexing into variables 'Qstart' and 'Send', respectively. They might be growing too large in the for-loops, which would lead to you trying to index outside of the dimensions of the arrays.
I hope this information proves to be helpful.
Matt
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!