How to save points on a graph
22 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Omer hakan Yaran
el 19 de Mayo de 2022
Respondida: Parsa
el 19 de Mayo de 2022
Hello everyone, there is a data set of a heart beat signals of a patient I am working on. I automatically labeled most of the peaks of the signals. However, there are some peaks that needs to be labeled manually. The data is a matrix, first column is the index number and the second column is the sensor value.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1004335/image.png)
As you can see, this point is missing and I want to add it to the data by clicking it on the graph. It needs to be the peak.
Thank you for your help and supporting medical science!
3 comentarios
Star Strider
el 19 de Mayo de 2022
You need to bandpass or highpass filter them to eliminate the baseline offset and baseline drift. (The highpass cutoff frequency and the bandpass low frequency should be about 1 Hz.) You can then use those location indices with the original EKG to label the R-wave deflections.
Respuesta aceptada
Parsa
el 19 de Mayo de 2022
Hi Omer
According to your question, I got that you want to add some points (peaks or maybe any other points) manually from the graph, and also locate them in your data vector.
So, after plotting your data, by holding 'alt' key and select the desired points, you could export them to the workspace. Then you maybe want to sort their location (indices) in the data vector. I wrote this simple code to show the process. Hope to be useful.
x=rand(1,30);
[pks,locs]=findpeaks(x);
allpks=[locs',pks'];
[r,c]=size(allpks);
plot(x)
hold all
plot(locs,pks,'o')
% select desired pts on the graph by holding 'alt' key:
%%
newpks = cell2mat({cursor_info.Position}');
allpks_aug=cat(1,allpks,newpks);
[locs_sort,idx]=sort(allpks_aug(:,1));
AllNewPks(:,1)=locs_sort;
AllNewPks(:,2)=allpks_aug(idx,2);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1004450/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1004455/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1004460/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1004465/image.png)
0 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!