I am using MatLab and I have two GUIs. When I click on a push button in one GUI, the second GUI will invoke, and both GUIs both can work in parallel. If any body knows answer to this question please give reply to me.
I have two GUI forms. In the first one I am rotating a line in a circle (by using the polar function. This is for my radar simulation purpose). In that GUI I have one push button. When I press it line (by using the for loop and pause function. Actually it's a simulation, kind of looks like a rotate in the circle)
The circle rotates until I press another pushbutton in the same GUI. I have one more push button. If I press this, it activates another GUI doing the same rotation but not the full circle, some part of the circle (sector). So here I need line in both circle and sector rotation. But actually what happens when I call the sector GUI (2nd GUI) from the circle GUI's pushbutton is that the line rotates in circle stops and control gives to sector after completion of the sector rotation. Circle is appearing in sector GUI.
If anybody knows how to execute these two GUIs in parallel, please answer me. If this is still too vague, please tell me and I will explain some more.
My code is below:
function twoguis
%Initializations:
hFigure2 = [];
hAxes2 = [];
%Make figure 1:
hFigure1 = figure('Position',[50 200 300 300]);
hAxes1 = axes('Parent',hFigure1,'Position',[0.1 0.2 0.8 0.7]);
hButton = uicontrol('Style','pushbutton',...
'Position',[10 10 100 20],...
'String','New Window',...
'Callback',@button);
% Start a loop that continuously changes the color of
% the axes at 1 second intervals:
while true, % You will have to press Ctrl-c to stop!
newColor = rand(1,3);
set(hAxes1,'Color',newColor);
if ishandle(hAxes2),
set(hAxes2,'Color',newColor);
end
drawnow;
pause(1);
end
function button(source,event)
% Check if Figure 2 has already been made:
if ishandle(hFigure2),
return;
end
% If it isn't made, make Figure 2:
hFigure2 = figure('Position',[350 200 300 300]);
hAxes2 = axes('Parent',hFigure2,'Position',[0.1 0.2 0.8 0.7]);
for xc=0:.05:6.28;
polar([0,xc],[0,10]);
pause(.1);
end
end
end
Can anyone suggest me how to change the color continuously and rotate the line in polar function continuously in two figures?