graphics displaying problem in gui after using copyobj
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Divyam
am 7 Nov. 2024
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
Siehe auch
Kategorien
Mehr zu Migrate GUIDE Apps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!