如何刷图然后在GUI中保存刷过的数据? [英] How to brush the plot and then save the brushed data in GUI?

查看:17
本文介绍了如何刷图然后在GUI中保存刷过的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经阅读了几篇关于如何保存刷过数据的帖子,但是,在尝试这些帖子的建议时(这个这个这个, thisthis),它们似乎都没有工作.我在尝试这些建议时遇到的一个问题是程序在刷任何数据之前一直运行到最后,因此保存的数据是一个空矩阵.

I have read couple of posts on how to save brushed data, however, on trying the suggestions on these posts (this, this, this, this and this), none of them seem to be working. One of the problem I encountered while trying these suggestions is that the program runs all the way through the end before any data is brushed, and therefore, the saved data is an empty matrix.

我的目标是:

  1. 刷数据,然后

  1. Brush the data, and

保存刷过的数据.

这是我尝试 从这里但似乎没有上班:

This is what I tried from here but it didn't seem to work:

t=0:0.2:25; plot(t,sin(t),'.-');
brush on
hBrushLine = findall(gca,'tag','Brushing');
brushedData = get(hBrushLine, {'Xdata','Ydata'});
brushedIdx = ~isnan(brushedData{1});
brushedXData = brushedData{1}(brushedIdx);
brushedYData = brushedData{2}(brushedIdx);

有人可以举一个简单的例子来说明如何做到这一点吗?我正在尝试在 GUI 中执行此操作.

Can someone show a simple example on how to do this? I am trying to do this in a GUI.

推荐答案

brush on 之后添加 pause 可以解决问题:

Adding pause after brush on does the trick:

t=0:0.2:25; plot(t,sin(t),'.-');
brush on
pause
hBrushLine = findall(gca,'tag','Brushing');
brushedData = get(hBrushLine, {'Xdata','Ydata'});
brushedIdx = ~isnan(brushedData{1});
brushedXData = brushedData{1}(brushedIdx);
brushedYData = brushedData{2}(brushedIdx);

这篇关于如何刷图然后在GUI中保存刷过的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆