Borrar filtros
Borrar filtros

Open project2 from button

1 visualización (últimos 30 días)
Rayane
Rayane el 26 de Dic. de 2013
Comentada: Rayane el 27 de Dic. de 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

Respuesta aceptada

Walter Roberson
Walter Roberson el 26 de Dic. de 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 comentario
Rayane
Rayane el 27 de Dic. de 2013
Thank you
Your answer was helpful

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by