Automatically select and name variables from import file (.xlsx)
Ältere Kommentare anzeigen
Hello,
I have an excel file with a column of variables. It looks like this:

The sequence is approx. 0.0237, -0.0016, 0.0018, 0.0239. Which should be named A, B, C, D. This sequence repeats in the same order 50 times (A1,B1,C1,D1, A2, B2, C2, D2, etc), but the values are different each time and the number of cells for A1, B1, etc varies. A and D are always in the range of 0.0001 to 0.0320, while B and C are always in the range 0.0010 to 0.0020.
At the moment, I am highlighting the cells from Import Data and naming them one by one.
I would like to automatically select 10 cells before B1, and name those A1. Automatically select all the cells for B1 and name them B1. Automatically select all the cells for C1 and name them C1. Finally, automatically select 10 cells after C1 and name them D1. This would be repeated for the other 49 times.
Any help would be appreciated!
Thank you.
5 Kommentare
Mathieu NOE
am 11 Mai 2021
hello
1/ could you share the excel file ?
2/ what is the range of B ? there must be a typo in your text, as you mention D twice and B never :
A and D are always in the range of 0.0001 to 0.0320, while C and D are always in the range 0.0010 to 0.0020.
meryem berrada
am 11 Mai 2021
Mathieu NOE
am 12 Mai 2021
Hello again
so I tried to understand your logic - how you split the data into the four groups
if I'm right , these blocks correspond to the four "plateau" phases that are here repeated several times.
But right now , I doubt that using only the criteria of min / max values can be enough and robust as one can see for exxample , the "B" section can be either positive and negative, and also the min / max values for each A/B/C/D group are not "excluding" - I mean the valid ranges do overlap.

I am more thinking about slecting portion of data that have very low slope (definitioon of a "plateau") with other constrains like min number of consecutive samples and distance to the previous section
J. Alex Lee
am 12 Mai 2021
can you take second derivative to find the "corners" and split on them?
meryem berrada
am 12 Mai 2021
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
