Open project2 from button

1 次查看(过去 30 天)
Hello
I'm having a problem when loading project2 from button in project1
My issue here is that when project2 opens it doesn't load what was created in the opening function of this project ! it only shows uicontrols created from outside in guide whitout also the changes made on them ...
here's how project2 in opened:
fig = openfig('Project2.fig');
& Those Changes weren't made ;
function Project2_OpeningFcn(hObject, eventdata, handles, varargin)
% Choose default command line output for Truss
handles.output = hObject;
global h
h=handles;
%--------------Image to Background-----------------------
img=imread('TrussMain.jpg');
[M, N, C]=size(img);
hAxes=axes;
hfigure=handles.figure1;
set(hfigure,'units','pixels','Position',[100 100 N M],'numbertitle','off');
set(hAxes,'units','pixels','Position',[1 1 N M],'box','off','tickdir','out','XLimMode','manual','XLim',[1 N],'YLimMode','manual','YLim',[1 M],'ydir','reverse');
hAxes=image(img);
%--------------Objects-----------------------
set(h.a2,'Position',[30,10,150,30]);
set(h.pp1,'Position',[195,36,10,6]);
set(h.t1,'Position',[170,39.5,25,2]);
Thank you in advance

采纳的回答

Walter Roberson
Walter Roberson 2013-12-26
When you have a figure created with GUIDE, you need to run the function that has the same name as the fig. In this case, it would be Project2(). Note that this will go through the whole singleton control and will create its own version of "handles", so you need to keep track of which "handles" you are using.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by