graphics displaying problem in gui after using copyobj
2 次查看(过去 30 天)
显示 更早的评论
I established a set of Gridlayout objs, and put a Label, a NumericEditField and a Slider obj into each of them, which displayed very well in GUI. After that, I want to established another set of Gridlayout objs in the same GUI,which contained some Gridlayout objs used before. The copyobj funtion did the great job, it copied everything Gridlayout objs used before. when I run the GUI, the Value of NumericEditField and Slider obj displayed was not same with I set. So how can I keep them remain same?
Objs to copy Objs copied(new parent)
0 个评论
回答(1 个)
Divyam
2024-11-7,4:43
Assuming that you're experiencing issues with the "copyObj" function not accurately copying data from the original GUI, I have faced this issue and this is a recognized problem with the "copyObj" function.
As a workaround, you can manually copy the original values from the GUI components. After using the "copyObj" function, you can then update the values of the objects that weren't copied correctly by using the values from the original GUI objects.
% Pseudocode
ef = uieditfield(); % Create your numeric edit field
editfieldValue = ef.Value;
sld = uislider(); % Create your slider
sliderValue = sld.Value;
% code for copied objs
copiedEF.Value = editfieldValue;
copiedSlider.Value = sliderValue;
Note: Before using "copyObj" function for a GUI object, you can go through this documentation section to have a better idea of properties that might need to be set again after copying the original object: https://www.mathworks.com/help/matlab/ref/copyobj.html?s_tid=doc_ta#:~:text=expand%20all-,What%20Is%20Not%20Copied,-Tips
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!