[英]Matlab GUIDE GUI Handles change in values after using Load() function?
Inside a GUI that I have made using GUIDE in Matlab. 在我使用Matlab中的GUIDE制作的GUI中。 I run into a problem where upon using the Load() function to load a .MAT file all my handles change values.
我遇到一个问题,在使用Load()函数加载.MAT文件时,我所有的句柄都会更改值。 This means that if I had a button that I wanted to use on my GUI.
这意味着如果我有一个要在GUI上使用的按钮。 My program will believe its handle is for example
我的程序会相信它的句柄例如
handles.button1 =190.082
when in reality the only way I can access that button any more is through a different handle that is unknown. 实际上,我无法再访问该按钮的唯一方法是通过未知的其他手柄。 So if its unknown lets see what its new handle must be.
因此,如果未知,请查看其新句柄必须是什么。
findobj('Tag','button1') = 227.0093
As you can see these numbers are completely different. 如您所见,这些数字完全不同。 Why the handles values get changed is beyond me.
为什么改变手柄值已经超出了我的范围。 Since the handles change I can no longer use the set() function as I have written in previous sections of code.
由于句柄发生了变化,因此我无法再使用前面代码部分中所写的set()函数。 For example I have to change
例如我必须改变
set(handles.button1, 'Enable', 'off');
to
set(findobj('Tag','button1'),'Enable','off');
Does anyone have an explanation as to why this problem occurs when using Load()
? 是否有人对使用
Load()
时为什么会发生此问题有解释? Is there a feasible solution instead of having to find the handle for an object every time you want to use it? 有没有可行的解决方案,而不必每次使用对象时都要查找对象的句柄?
.MAT文件中还方便地包含了handles变量,该变量覆盖了我当前的handle。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.