필터 지우기
필터 지우기

Open project2 from button

조회 수: 1 (최근 30일)
Rayane
Rayane 2013년 12월 26일
댓글: Rayane 2013년 12월 27일
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.
  댓글 수: 1
Rayane
Rayane 2013년 12월 27일
Thank you
Your answer was helpful

댓글을 달려면 로그인하십시오.

추가 답변 (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