WICHTIG: Der Betrieb von goMatlab.de wird privat finanziert fortgesetzt. - Mehr Infos...

Mein MATLAB Forum - goMatlab.de

Mein MATLAB Forum

 
Gast > Registrieren       Autologin?   

Partner:




Forum
      Option
[Erweitert]
  • Diese Seite per Mail weiterempfehlen
     


Gehe zu:  
Neues Thema eröffnen Neue Antwort erstellen

Plot im anderen Fenster! Mit Video!

 

Blackfish84
Forum-Anfänger

Forum-Anfänger


Beiträge: 20
Anmeldedatum: 30.04.09
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 28.05.2009, 18:02     Titel: Plot im anderen Fenster! Mit Video!
  Antworten mit Zitat      
Hallo alle zusammen!
Ich möchte gerne undabhängig vom ausgewählten Fenster verschiedene plots ausgeben. Mein Problem ist nämlich, dass sobald ich das ein anderes Fenster aktiviere die plots in dem vorderen Fenster geplottet werden!
Vielleicht weiß jemand einen Rat.

Hier mal zum anschauen:
http://www.youtube.com/watch?v=OTnGZsAFyHM



Vielen Dank im Voraus!

Grüße
Martin

Code:

function sensorPlot(obj, event, handles)

    PLOTSENSORS         = [1 2 3 4 5 6 7];
    SENSORNAMES         = {'1','2','3','4','5','6','7'};


% display('Press w or s to change the timespan of the window');
% display('Press a or z to change the lowerbound of vertical axis');
% display('Press e or r to change the upperbound of vertical axis');
display('Press q to quit');

i=1;
tic;
tijd(1)=0;

colordef none
figure1 = figure('Name','Test','Color',[0.3 0.3 0.3]);
axes1 = axes('Parent',figure1);
%set(h,'KeyPressFcn',@keyHandler);
quit=0;
timespan=100;   ymin = 0;   ymax = 1000;
paused=0;
while ~quit
    while (paused)
        %pause(0.02);
    end
    if get(handles.pushbutton_start_burstmode, 'UserData')
        res = [1 2 3 4 5 6 7];
        if i>1
            tijd(i) = toc;
            tijd(i)=tijd(i)+tijd(i-1);
        end
        tic
        A(i,:) = res;
        b=0;
        for j=PLOTSENSORS
            b=b+1;
            subplot(length(PLOTSENSORS),1,b);
             if i>timespan
                 plot(tijd(i-timespan+1:i),A(i-timespan+1:i,j),'g','lineWidth',2);
                 xlim([tijd(i-timespan+1) tijd(i)]);
             else
                plot(tijd,A(:,j),'g','lineWidth',2);
             end
             %ylim([ymin ymax]);
             box off
            title(SENSORNAMES{j});
        end
        i=i+1;
        pause(0.00000001);
    end
end
 
Private Nachricht senden Benutzer-Profile anzeigen


steve
Ehrenmitglied

Ehrenmitglied



Beiträge: 2.022
Anmeldedatum: 03.09.07
Wohnort: Wien
Version: R2023b
     Beitrag Verfasst am: 28.05.2009, 20:46     Titel:
  Antworten mit Zitat      
Moin,

ja gibt es, du musst dir einfach die handles der axes in dem figure holen oder geben lassen und diese dann mit in den plotbefehl schreiben:
Code:
figure(1), % figure wird erstellt
hF1 = gca; % handle zu aktuellen axes speichern
plot(...); % wird in diesem figure geplottet

figure(2), % neues figure wird geöffnet
plot(hF1, ...); % wird im ersten Fenster geplottet

...ohne Gewähr, da nicht getestet.

Gruß
Alex
_________________

>> I told me to.

____________________________________
Matlab Cheat Sheet
goMatlab-Knigge - dran gehalten?!
Schon in den FAQ gesucht?
Ist vielleicht bei den Skripten oder den Tutorials was für dich dabei?
Private Nachricht senden Benutzer-Profile anzeigen
 
Blackfish84
Themenstarter

Forum-Anfänger

Forum-Anfänger


Beiträge: 20
Anmeldedatum: 30.04.09
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 29.05.2009, 09:55     Titel:
  Antworten mit Zitat      
Hallo!

Danke schonmal für die Antwort! Ich habe es mal ausprobiert aber es hat leider nicht geklappt! Ich poste nochmal den neuen Quelltext! Jetzt bekomme ich sobald ich das andere Fenster anwähle eine Fehlermeldung:

??? Error using ==> set
Axes must be an existing child of figure



Code:

function sensorPlot(obj, event, handles)

   
    PLOTSENSORS         = [1 2 3 4 5 6 7];
    SENSORNAMES         = {'1','2','3','4','5','6','7'};


% display('Press w or s to change the timespan of the window');
% display('Press a or z to change the lowerbound of vertical axis');
% display('Press e or r to change the upperbound of vertical axis');
display('Press q to quit');

i=1;
tic;
tijd(1)=0;

colordef none
handles.plotfigure = figure('Name','Test','Color',[0.3 0.3 0.3]);
%handles.axes1 = axes('Parent',handles.plotfigure);
hF1 = gca;

%set(h,'KeyPressFcn',@keyHandler)
quit=0;
timespan=100;   ymin = 0;   ymax = 1000;
paused=0;
while ~quit
    while (paused)
        %pause(0.02);
    end
    if get(handles.pushbutton_start_burstmode, 'UserData')
        res = [1 2 3 4 5 6 7];
        if i>1
            tijd(i) = toc;
            tijd(i)=tijd(i)+tijd(i-1);
        end
        tic
        A(i,:) = res;
        b=0;
        for j=PLOTSENSORS
            b=b+1;
            subplot(length(PLOTSENSORS),1,b);
             if i>timespan
                 %plot(handles.axes1,tijd(i-timespan+1:i),A(i-timespan+1:i,j),'g','lineWidth',2);
                 plot(tijd(i-timespan+1:i), A(i-timespan+1:i,b),'g','lineWidth',2);
                 %xlim([tijd(i-timespan+1) tijd(i)]);
                 %set(handles.plotfigure,'Parent',handles.axes1);
                 set(handles.plotfigure,'CurrentAxes',gca);
             else
                %plot(handles.axes1,tijd,A(:,j),'g','lineWidth',2);
                plot(tijd,A(:,j),'g','lineWidth',2);
                %set(handles.plotfigure,'Parent',handles.axes1);
                set(handles.plotfigure,'CurrentAxes',gca);

               
             end
             %ylim([ymin ymax]);
             box off
            title(SENSORNAMES{j});
        end
        i=i+1;
        pause(0.00000001);
    end
end
 


Vielen Dank im Vorraus!

Grüße

Martin
Private Nachricht senden Benutzer-Profile anzeigen
 
steve
Ehrenmitglied

Ehrenmitglied



Beiträge: 2.022
Anmeldedatum: 03.09.07
Wohnort: Wien
Version: R2023b
     Beitrag Verfasst am: 29.05.2009, 10:38     Titel:
  Antworten mit Zitat      
Moin,

was genau willst du mit diesen Zeilen erreichen?
Code:
set(handles.plotfigure,'CurrentAxes',gca);
 


Gruß
Alex
_________________

>> I told me to.

____________________________________
Matlab Cheat Sheet
goMatlab-Knigge - dran gehalten?!
Schon in den FAQ gesucht?
Ist vielleicht bei den Skripten oder den Tutorials was für dich dabei?
Private Nachricht senden Benutzer-Profile anzeigen
 
Neues Thema eröffnen Neue Antwort erstellen



Einstellungen und Berechtigungen
Beiträge der letzten Zeit anzeigen:

Du kannst Beiträge in dieses Forum schreiben.
Du kannst auf Beiträge in diesem Forum antworten.
Du kannst deine Beiträge in diesem Forum nicht bearbeiten.
Du kannst deine Beiträge in diesem Forum nicht löschen.
Du kannst an Umfragen in diesem Forum nicht mitmachen.
Du kannst Dateien in diesem Forum posten
Du kannst Dateien in diesem Forum herunterladen
.





 Impressum  | Nutzungsbedingungen  | Datenschutz | FAQ | goMatlab RSS Button RSS

Hosted by:


Copyright © 2007 - 2024 goMatlab.de | Dies ist keine offizielle Website der Firma The Mathworks

MATLAB, Simulink, Stateflow, Handle Graphics, Real-Time Workshop, SimBiology, SimHydraulics, SimEvents, and xPC TargetBox are registered trademarks and The MathWorks, the L-shaped membrane logo, and Embedded MATLAB are trademarks of The MathWorks, Inc.