Of course I can just hard code that the first and last few lines are deleted, but I wonder if there is a more elegant solution.
Can ginput be used with a fixed window size?
6 views (last 30 days)
Show older comments
Catherine Matje
on 8 Mar 2022
Edited: Bjorn Gustavsson
on 8 Mar 2022
Hey everyone,
I really need some adivce, because I am definitely no Matlab expert.
My Problem is that I have a number of plots of which I only need a certain, but always the same, number of datapoints. So like a starting point and an endpoint. I know I could use ginput() but the selection should be automated and always bring the same amount of datapoints, which I don't manage with ginput(). Is there any other function of ginput() or a totally different function I could use?
Thanks so much,
Catherine
Accepted Answer
Bjorn Gustavsson
on 8 Mar 2022
You can tell ginput to return N points:
N = 11;
[x,y,B] = ginput(N);
Then ginput will stop after N points are selected.
HTH
2 Comments
Bjorn Gustavsson
on 8 Mar 2022
Edited: Bjorn Gustavsson
on 8 Mar 2022
If you know exactly what lines you're interested in just use the handles returned from your call to plot and delete the ones you want removed:
idxBaddies = [1 2 5 9];
ph = plot(x,y);
% After the required viewing/whatevering of the entire set of curves
delete(ph(idxBaddies))
If you still want the user to select some set of lines to keep/remove you might find something on the file exchange. Just look for "line highlight matlab" with a search-engine of your choise. Perhaps you can build something starting with the code in this contribution: makelinehighlightable
HTH
More Answers (0)
See Also
Categories
Find more on Data Exploration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!