首页 \ 问答 \ MATLAB:GUI按钮调用函数.m(MATLAB : GUI pushbutton call function .m)

MATLAB:GUI按钮调用函数.m(MATLAB : GUI pushbutton call function .m)

我在matlab(.m)上创建了一些函数。 我想在界面GUI上调用它们:我的按钮回调函数如何调用函数.m(在同一个工作区中)? 此外,我的函数返回一些变量,所以我想将这些变量保存在我的工作区中,以便从我界面的其他按钮访问它们。 之后,是否可以将变量的结果放在我的界面上?

先谢谢你,

最好的祝福


I have some functions create on matlab (.m). And I would like to call them on an interface GUI : how my push button callback function can call a function .m (which is in the same workspace) ? Moreover, my function returns some variables so I would like to keep these variables in my workspace in order to access them from other buttons of my interface. And after, is it possible to put the result of a variable on my interface ?

Thank you in advance,

Best regards


原文:https://stackoverflow.com/questions/29063407
更新时间:2022-11-10 17:11

最满意答案

level元素最适合这个任务(正如@ensonic已经提到过的)它的目的正是你所需要的......

所以基本上你添加到名为“level”的管道元素,然后启用消息触发。

然后,Level元素发出包含RMS Peak和Decay值的消息。 RMS是您所需要的。

您可以设置连接到此类消息事件的回调函数:

audio_level = gst_element_factory_make ("level", "audiolevel");
g_object_set(audio_level, "message", TRUE, NULL);
...
g_signal_connect (bus, "message::element", G_CALLBACK (callback_function), this);

总线变量是GstBus类型..我希望你知道如何使用总线

然后在回调函数中检查元素名称并获得如此处所述的RMS

还有使用pow()函数的规范化算法,可以转换为0.0 - > 1.0之间的值,您可以使用它转换为%,如您在问题中所述。


The level element is best for this task (as @ensonic already mentioned) its intended for exactly what you need..

So basically you add to your pipe element called "level", then enable the messages triggering.

Level element then emits messages which contains values of RMS Peak and Decay. RMS is what you need.

You can setup callback function connected to such message event:

audio_level = gst_element_factory_make ("level", "audiolevel");
g_object_set(audio_level, "message", TRUE, NULL);
...
g_signal_connect (bus, "message::element", G_CALLBACK (callback_function), this);

bus variable is of type GstBus.. I hope you know how to work with buses

Then in callback function check for the element name and get the RMS like is described here

There is also normalization algorithm with pow() function to convert to value between 0.0 -> 1.0 which you can use to convert to % as you stated in your question.

相关问答

更多
  • 我在网上看到很多关于这个问题的回答,说你应该直接调用libjpeg并绕过OpenCV的imread()例程。 这不是必要的! 您可以使用imdecode()从内存中解码原始图像缓冲区。 实现这一目标的方式不直观,并且没有足够的文档来帮助人们尝试第一次这样做。 如果您的原始文件数据(fread()直接来自.jpg,.png,.tif,文件等等)的指针/大小... int nSize = ... // Size of buffer uchar* pcBuffer = ... // Raw ...
  • level元素最适合这个任务(正如@ensonic已经提到过的)它的目的正是你所需要的...... 所以基本上你添加到名为“level”的管道元素,然后启用消息触发。 然后,Level元素发出包含RMS Peak和Decay值的消息。 RMS是您所需要的。 您可以设置连接到此类消息事件的回调函数: audio_level = gst_element_factory_make ("level", "audiolevel"); g_object_set(audio_level, "message", TRUE, ...
  • 有一个标准的Python函数imghdr.what 。 它统治! ^ __ ^ There is a standard Python functionimghdr.what. It rulez! ^__^
  • 在命令行中,您可以使用#n来寻址链接到缓冲区编号n的文件: :ls " list buffers :r #3 " read from file associated with buffer 3 请注意:r从文件读取,而不是从缓冲区读取,并且缓冲区的内容可能与其关联文件的内容不同。 如果要访问缓冲区的内容,则无法真正避免编写脚本(如Luc Hermitte的答案)。 In the command-line, you can use #n to address the file linked ...
  • 修复你的数据包处理。 我总是最终为这样的实例使用状态机,所以如果我得到部分消息,我记得(有状态的)我停止处理的地方,并且可以在剩下的数据包到达时恢复。 通常,在进行其他处理之前,我必须在数据包末尾验证校验和,因此“我停止处理的位置”总是“等待校验和”。 但是我存储了部分数据包,以便在更多数据到达时使用。 即使你不能窥探到驱动程序缓冲区,你可以将所有这些字节加载到你自己的缓冲区中(在C ++中, deque是一个不错的选择),并且可以窥探到你想要的全部内容。 Fix your packet processin ...
  • 是的,这可能是由于读卡器端的cpu缓存造成的。 有人可能会认为“volatile”关键字应该可以防止出现这种问题,但这并不完全正确,因为volatile只是指令编译器不注册变量,而不是指导cpu直接从主内存读取每次。 这个问题需要在写入方面解决。 根据您的描述,这听起来像是在内核模块中进行写入并从用户端读取。 如果这两个操作发生在不同的cpus(不同的缓存域)上,并且没有任何东西可以在读取端触发缓存失效,那么在描述时你将被困在读取端。 您需要在存储指令后强制在Linux内核上刷新存储缓冲区。 假设它是lin ...
  • Curl无法帮助您解析HTML,这是一项复杂的任务。 您可以阅读语言规范并编写解析器。 在http://www.mbayer.de/html2text/上有一个开源C ++项目,在https://github.com/aaronsw/html2text上有一个python脚本。 您还可以从命令行安装和使用html2text,或者从您的c代码执行它。 Curl will not help you with parsing HTML, and it is a complicated task. You can ...
  • 我建议使用压缩结构或带有效负载部分的大缓冲区: +------------------------------------+ | | | +----------+----------+--------+ | | | Header | Payload | Footer | | | +----------+----------+--------+ | | transmit buffer ...
  • 你在这里问了两个问题。 首先, php://输入与STDIN相同 。 其次,如果要保存echo或print函数的输出 ,则应使用输出控制功能 。 Your asking two questions here. First, php://input is the same as STDIN. Second if you want to save the output of echo or print functions, you should use the output control functions. ...
  • 如果数字是分隔的,那么在Let_Me_Be这样的缓冲区上直接使用strtod很有效。 但是,由于数字没有分隔,所以不能直接使用strtod 。 如果缓冲区为零(或eof)终止,那么您可以简单地修改它,在数字后面添加终止符,然后恢复原始字符,例如建议的bolov。 由于结束偏移量是数字的一部分,因此总是至少有终止符,所以offset_end不会溢出。 以下代码假定offset_end是最后一个字符之后的一个。 如果它是最后一个字符,那么只需使用+ 1 。 auto original = data[offset ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。