Sensing the data changes and plotting
Ältere Kommentare anzeigen
I have a table "a" which has multiple rows and 2 columns; t for time and q for data. I attached here.
I want to plots the period only where the sudden change of value happens (from start to end of the changes) such as I showed in figure where the value jumped from nearly -4 to -43.65.

After that I'd like to generate a table of the data of the plot. There will be many periods where such kind of data changes occurs so I want to plot everytime with that data changes.
load = 'newdata3.csv';
data = readtable(load);
data = sortrows(data,'Var1','ascend');
timetable(data.Var1, data.Var2);
plot(data.Var1,data.Var2)
findchangepts(data.Var2,'MaxNumChanges',20)
Here, I tried and it is not showing at the correct changes points. There are 12 changes points and it is only showing 5 of them. I don't know how to fix this.
Antworten (1)
Image Analyst
am 27 Okt. 2022
Do you have the Image Processing Toolbox? If so, it's easy.
v = a.V;
mask = v > 200
props = regionprops(mask, 'PixelIdxList');
numRegions = numel(props);
coords = vertcat(props.PixelIdxList);
startingRows = coords(:, 2);
or something similar. It would have been easier if you had read the posting guidelines and remembered to attach your data.
To learn other fundamental concepts, invest 2 hours of your time here:
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
12 Kommentare
uzzi
am 27 Okt. 2022
Image Analyst
am 28 Okt. 2022
uzzi
am 28 Okt. 2022
Your data looks weird:
a = readtable('newdata3.csv')
t = a.Var1;
v = a.Var2;
plot(t, v, 'b-');
grid on;
mask = v > 20;
props = regionprops(mask, 'PixelIdxList');
numRegions = numel(props)
startingRows = vertcat(props.PixelIdxList)
uzzi
am 28 Okt. 2022
Image Analyst
am 28 Okt. 2022
OK, what's your threshold? It looks like you could use a global threshold everywhere, like 5 or something.
uzzi
am 29 Okt. 2022
uzzi
am 29 Okt. 2022
Image Analyst
am 30 Okt. 2022
Yes, of course. Images are data. And many of the image processing functions work just as well on 1-D signals as well as 2-D and 3-D images.
uzzi
am 31 Okt. 2022
Image Analyst
am 1 Nov. 2022
Yes. But I don't know what you want.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
uzzi
am 1 Nov. 2022
Kategorien
Mehr zu Annotations finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


