Filter löschen
Filter löschen

Open project2 from button

1 Ansicht (letzte 30 Tage)
Rayane
Rayane am 26 Dez. 2013
Kommentiert: Rayane am 27 Dez. 2013
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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 26 Dez. 2013
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.
  1 Kommentar
Rayane
Rayane am 27 Dez. 2013
Thank you
Your answer was helpful

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

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!

Translated by