selecting region of plot for calculations
Ältere Kommentare anzeigen
Hi
I have a signal 24 hours long. I would like to plot the signal over time sampling rate 0.97samples/sec. then select a region on that plot, have that selected region show as a sub plot. then i can press a button and do the calculations i want on it(min max,slope of decline,...) and show the results in a box next to the graph. If a new region of the original plot is selected it will erase the prevoius subplot and calculations with the new slected region and allow for new calculation. I would appriciate and input on this. I tried making a gui a few times and it gets confussing after a point and i get stuck. Thank you in advance for your help!
please let me know if further explanation is needed.
y data range 50:100
11 Kommentare
Mario Malic
am 28 Aug. 2020
Bearbeitet: Mario Malic
am 28 Aug. 2020
You can create a function that accepts arguments (app, xmin, xmax) and do the calculation in there. For the graph part, you'll need a callback function for it. I do not remember a name for it, but there are some properties that are useful in your case, such as key pressed and key released.
After you create a callback, run the app from command window and try to change values from there, once you make it that way, you will know what you have to write in App Designer.
ALDO
am 28 Aug. 2020
Mario Malic
am 28 Aug. 2020
Bearbeitet: Mario Malic
am 3 Sep. 2020
Sorry, I have mistaken on these callbacks, actually, for UIAxes mentioned callback does not exist. EDIT2: Actually there are, I must have looked on wrong place for properties. see Ayush's answer below.
I hope you have access to App Designer, I made a small example to get you started.
You can use a slider property of MinorTicks to set it accordingly to sampling rate values, or you can use integers as well. These sliders change the X limits of the plot, so once you are happy with the selected region you can get XMin, XMax values, and Y (XMin:XMax) and do the calculations in the function.
Add a few components of Edit field (numeric) that will obtain the results(properties) from the function.
And lastly, make a button that will call the function.
Edit: I didn't read the question correctly. You have a vector with ~90000 elements, In such case, you can try adding another way of controling XLim: Maybe 3 sliders for seconds, minutes and hours, or (a) Numeric Field(s).
Do few examples that are on the starting screen, they are really helpful.

ALDO
am 3 Sep. 2020
ALDO
am 3 Sep. 2020
Mario Malic
am 4 Sep. 2020
Do you have access to App Designer? I have not worked with GUIDE, but I think App Designer is superior and easier to use than GUIDE
ALDO
am 4 Sep. 2020
Mario Malic
am 4 Sep. 2020
It is more of understanding about what you can do with each command/function. I started using App Designer 2 weeks ago and made a quite complex app that deals with tons of stuff.
For example we mentioned callbacks, in App designer, you just right click the field and there's an option to create a callback, everything gets written, you just have to say, what do you want to do with the value user inputs in.
Also, you don't have to press Start button from App designer to check if the program works properly, you can call the app through Command Window i.e. (app = name), and you can type commands that will be directly executed in the app.
ALDO
am 4 Sep. 2020
Mario Malic
am 5 Sep. 2020
Bearbeitet: Mario Malic
am 5 Sep. 2020
In case you decide for the App Designer, here's a small start.
I somehow managed to get the x and y values of plots, see the windows button up/down callback. It's not so far from what you want to do.
ALDO
am 8 Sep. 2020
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Startup and Shutdown 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!