Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
How Can I run two guis in parallel

Subject: How Can I run two guis in parallel

From: Jose

Date: 21 Aug, 2009 15:18:02

Message: 1 of 1

Hi everyone again, now, I am going to try to explain much better my problem:

If you run this function (twoguis), you can see how the two guis run in parallel independiently if you move the mouse over figure 1 or figure 2. It is great.

But, my problem is , how I can modify this code to run a cos function instead the polar function that appear in the figure 2.

I try to do it (code comments) but it doesn't work.

Please, I need help.

Thnaks in advance,


function twoguis
    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',...
    % 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);
        if ishandle(hAxes2),

    function button(source,event)
    % Check if Figure 2 has already been made:
        if ishandle(hFigure2),
        % 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]);
        tmr = timer('TimerFcn',@spin, 'executionmode','fixedrate','period',.1);

        function spin(obj, event)
            polar(hAxes2,[0,get(obj, 'TasksExecuted')*0.05],[0,10]);

% start my code modifications, but it doesn't work.
% i=0;
% x=0;
% while 1
% i=i+1;
% xdin=i*0.1;
% drawnow
% x=[x xdin];
% y=cos (x);
% plot(x,y)
% end

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us