Opening Multiple Gui Problem
1 回表示 (過去 30 日間)
古いコメントを表示
Onur ALPAY
2020 年 3 月 1 日
コメント済み: Onur ALPAY
2020 年 3 月 4 日
Hi,
I have finished a gui project. It has two button. One of them to get excel file the other one is for to calculation. When i push the second button five more interface open on the background. What is the main reason of this and how can I solve it?
3 件のコメント
Image Analyst
2020 年 3 月 1 日
Attach the m-file and .fig file with the paper clip icon so we can actually run it ourselves.
採用された回答
Thiago Henrique Gomes Lobato
2020 年 3 月 1 日
When you do
save CVD
save PVD
...
you're actually saving your whole workspace, and thus later when you load it, you, at the same time, load many other GUI's and that's why you see other instances of the interface. You have here two options, either save only the variable, like:
save('CVD.mat','CVD')
Or, better, you use one of the standard methods to transfer data inside a GUI, as for example the handles structure (in this page there's a little tutorial http://matlab.izmiran.ru/help/techdoc/creating_guis/ch_program22.html). Basically you save all your variables in a structure called handles:
function callback1...
handles.CVD = 1; % Save variable in handles
guidata(hObject,handles); % tell the GUI to "update" the handles variable so other callback can see it
end
function callback2...
CVD = handles.CVD; % if you do first callback1 handles.CVD will now be 1
end
3 件のコメント
Thiago Henrique Gomes Lobato
2020 年 3 月 2 日
For matlab there's absolutely no difference between KontrolVeri and CVD in respect to save the variable/pass to the structure, so when you write
save KontrolVeri
you still save the interface within. In your code there's also no variable named 'ShutterDizi', only ShutterDizisi, which is defined at the VeriSec_Callback and will not be calleble in any other callback of your interface unless you save it somehow, as for example with the handles approach.
その他の回答 (1 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!