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

App designer remember the last plot

 

Matlab Noob
Forum-Newbie

Forum-Newbie


Beiträge: 8
Anmeldedatum: 28.10.21
Wohnort: ---
Version: ---
     Beitrag Verfasst am: 03.11.2021, 09:47     Titel: App designer remember the last plot
  Antworten mit Zitat      
hello,

but i have the problem that my user interface remembers the last plot. that means when i restart the program it works with the error message. but as soon as i plotted it once and then run it again, it remembers the last plot and even if i don't enter anything and also don't select an excel file, it just plots the one from before. so even if i only leave out one thing it takes over the one from the plot before...

does anyone know how i can prevent this?

merci

Code:
  [file, path] = uigetfile('*.xlsx','Select your Excel file','C:\');
           
           
             if isequal(file,0)
                 msgbox('Please input an Excel file')
                 
           
               
               
            else
                 [status,sheets]=xlsfinfo([path file]);
               selectedsheet=listdlg('ListString',sheets);
               
               msgbox('choose title, x and y axis')
               
                global t
                t = xlsread(fullfile(path, file),selectedsheet);
                app.UITable.Data = t;
               
                x1 = 0;
                x2 = 0;
               
                % Set column names as a pull down menu
                %app.xDropDown.Items = t.Properties.VariableNames;
                %app.yDropDown.Items = t.Properties.VariableNames;
               
                %plot(app.UIAxes, app.UITable.Data.(app.xDropDown.Value), app.UITable.Data.(app.yDropDown.Value));
            end
           
        end

        % Callback function
        function xDropDownValueChanged(app, event)
            value = app.xDropDown.Value;
           
            plot(app.UIAxes, app.UITable.Data.(app.xDropDown.Value), app.UITable.Data.(app.yDropDown.Value));
        end

        % Callback function
        function yDropDownValueChanged(app, event)
            value = app.yDropDown.Value;
           
            plot(app.UIAxes, app.UITable.Data.(app.xDropDown.Value), app.UITable.Data.(app.yDropDown.Value));
        end

        % Button pushed function: PlotButton
        function PlotButtonPushed(app, event)
        global t b titlename xaxis yaxis x1 x2 n;
           
                if isempty(xaxis)
                msgbox('to plot select xaxis');
               
                elseif isempty(yaxis)
                msgbox('to plot select yaxis')
               
                elseif isempty(titlename)
                msgbox('to plot select titlename')
               
                elseif isequal(b,0)
                    msgbox('to plot select column')
                   
                elseif isequal(x2,0)
                    msgbox('to plot select ends at')
           
            else
           
            O=t(:,1:b)
           
            sizeO = size(O);
            n = sizeO(1,1);
           
            x = linspace(x1, x2, n);
           
            %figH = figure;
            %set(figH,'Name',titlename,'NumberTitle','off');
           
            plot(x, O);
           
           
           
            title(titlename)
            xlabel(xaxis)
            ylabel(yaxis)
           
            legend
           
                end
               
           

        end

        % Value changed function: titlenameTextArea
        function titlenameTextAreaValueChanged(app, event)
            global titlename
            titlename = app.titlenameTextArea.Value;
           
        end

        % Value changed function: xaxisnameTextArea
        function xaxisnameTextAreaValueChanged(app, event)
           global xaxis
            xaxis = app.xaxisnameTextArea.Value;
         
        end

        % Value changed function: yaxisnameTextArea
        function yaxisnameTextAreaValueChanged(app, event)
            global yaxis
            yaxis= app.yaxisnameTextArea.Value;
           
        end

        % Cell selection callback: UITable
        function UITableCellSelection(app, event)
            global indices
            indices = event.Indices
           
        end

        % Value changed function: columnEditField
        function columnEditFieldValueChanged(app, event)
            global b
            b = app.columnEditField.Value;
           
            t2 = zeros(b,1);
            for i = 1:b
                t2(i) = "insert text";
            end
            app.UITable2.Data = t2;
           
            msgbox('select Legend lines in the table')
           
        end

        % Value changed function: startsatEditField
        function startsatEditFieldValueChanged(app, event)
            global x1
            x1 = app.startsatEditField.Value;
           
        end

        % Value changed function: endsatEditField
        function endsatEditFieldValueChanged(app, event)
            global x2
            x2 = app.endsatEditField.Value;
           
        end

        % Callback function
        function pointsEditFieldValueChanged(app, event)
            global n
            n = app.pointsEditField.Value;
           
        end

        % Cell edit callback: UITable2
        function UITable2CellEdit(app, event)
            indices = event.Indices;
            newData = event.NewData;
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.