Unrecognized property 'f' for class 'Graduation_project_awni_and_mazen' idont what to do with this error help please.
    3 次查看(过去 30 天)
  
       显示 更早的评论
    
classdef Graduation_project_awni_and_mazen < matlab.apps.AppBase
    % Properties that correspond to app components
    properties (Access = public)
        UIFigure                       matlab.ui.Figure
        EditField                      matlab.ui.control.NumericEditField
        samplerateEditFieldLabel       matlab.ui.control.Label
        samplerateEditField            matlab.ui.control.NumericEditField
        timeEditFieldLabel             matlab.ui.control.Label
        timeEditField                  matlab.ui.control.NumericEditField
        timeconstantEditFieldLabel     matlab.ui.control.Label
        timeconstantEditField          matlab.ui.control.NumericEditField
        cutofffrequencyEditFieldLabel  matlab.ui.control.Label
        cutofffrequencyEditField       matlab.ui.control.NumericEditField
        TabGroup                       matlab.ui.container.TabGroup
        CurrentReadingsTab             matlab.ui.container.Tab
        UIAxes_2                       matlab.ui.control.UIAxes
        UIAxes_3                       matlab.ui.control.UIAxes
        UIAxes_4                       matlab.ui.control.UIAxes
        TheoreticalNaturalFrequenciesTab  matlab.ui.container.Tab
        UIAxes_16                      matlab.ui.control.UIAxes
        UIAxes_17                      matlab.ui.control.UIAxes
        UIAxes_18                      matlab.ui.control.UIAxes
        UIAxes_19                      matlab.ui.control.UIAxes
        calculateeigenvaluesandmodeshapesButton  matlab.ui.control.Button
        Kth1barEditFieldLabel          matlab.ui.control.Label
        Kth1barEditField               matlab.ui.control.NumericEditField
        Kt1barEditFieldLabel           matlab.ui.control.Label
        Kt1barEditField                matlab.ui.control.NumericEditField
        Kth2barEditFieldLabel          matlab.ui.control.Label
        Kth2barEditField               matlab.ui.control.NumericEditField
        Kt2barEditFieldLabel           matlab.ui.control.Label
        Kt2barEditField                matlab.ui.control.NumericEditField
        eigenvalue1EditFieldLabel      matlab.ui.control.Label
        eigenvalue1EditField           matlab.ui.control.NumericEditField
        eigenvalue2EditFieldLabel      matlab.ui.control.Label
        eigenvalue2EditField           matlab.ui.control.NumericEditField
        eigenvalue3EditFieldLabel      matlab.ui.control.Label
        eigenvalue3EditField           matlab.ui.control.NumericEditField
        eigenvalue4EditFieldLabel      matlab.ui.control.Label
        eigenvalue4EditField           matlab.ui.control.NumericEditField
        Label_2                        matlab.ui.control.Label
        massperunitlengthkgmEditFieldLabel  matlab.ui.control.Label
        massperunitlengthkgmEditField  matlab.ui.control.NumericEditField
        youngmodulusGpaEditFieldLabel  matlab.ui.control.Label
        youngmodulusGpaEditField       matlab.ui.control.NumericEditField
        momentofaream4EditFieldLabel   matlab.ui.control.Label
        momentofaream4EditField        matlab.ui.control.NumericEditField
        lengthmEditFieldLabel          matlab.ui.control.Label
        lengthmEditField               matlab.ui.control.NumericEditField
        frequency4HzEditFieldLabel     matlab.ui.control.Label
        frequency4HzEditField          matlab.ui.control.NumericEditField
        frequency3HzEditFieldLabel     matlab.ui.control.Label
        frequency3HzEditField          matlab.ui.control.NumericEditField
        frequency2HzEditFieldLabel     matlab.ui.control.Label
        frequency2HzEditField          matlab.ui.control.NumericEditField
        frequency1HzEditFieldLabel     matlab.ui.control.Label
        frequency1HzEditField          matlab.ui.control.NumericEditField
        calculatefrequeniesButton      matlab.ui.control.Button
        AllPwoerSpectrum1Tab           matlab.ui.container.Tab
        UIAxes_5                       matlab.ui.control.UIAxes
        UIAxes_6                       matlab.ui.control.UIAxes
        UIAxes_7                       matlab.ui.control.UIAxes
        UIAxes_8                       matlab.ui.control.UIAxes
        UIAxes_10                      matlab.ui.control.UIAxes
        AllPwoerSpectrum2Tab           matlab.ui.container.Tab
        UIAxes_11                      matlab.ui.control.UIAxes
        UIAxes_12                      matlab.ui.control.UIAxes
        UIAxes_13                      matlab.ui.control.UIAxes
        UIAxes_14                      matlab.ui.control.UIAxes
        UIAxes_15                      matlab.ui.control.UIAxes
        FinialPowerSpectrumTab         matlab.ui.container.Tab
        UIAxes                         matlab.ui.control.UIAxes
        Tables                         matlab.ui.container.Tab
        TabGroup2                      matlab.ui.container.TabGroup
        OriginalSignalTab              matlab.ui.container.Tab
        UITable                        matlab.ui.control.Table
        EditedSignalTab                matlab.ui.container.Tab
        UITable_2                      matlab.ui.control.Table
        PowerSpectrumTab               matlab.ui.container.Tab
        UITable_4                      matlab.ui.control.Table
        notacceptableButton            matlab.ui.control.Button
        finishButton                   matlab.ui.control.Button
        startButton                    matlab.ui.control.Button
        clearButton                    matlab.ui.control.Button
        ControlPanelLabel              matlab.ui.control.Label
        Label                          matlab.ui.control.Label
        exitationtypeSwitchLabel       matlab.ui.control.Label
        exitationtypeSwitch            matlab.ui.control.RockerSwitch
        dummytestLampLabel             matlab.ui.control.Label
        dummytestLamp                  matlab.ui.control.Lamp
        earthgravityKnobLabel          matlab.ui.control.Label
        earthgravityKnob               matlab.ui.control.DiscreteKnob
        dummytestButton                matlab.ui.control.Button
        clipSwitchLabel                matlab.ui.control.Label
        clipSwitch                     matlab.ui.control.RockerSwitch
        portEditFieldLabel             matlab.ui.control.Label
        portEditField                  matlab.ui.control.EditField
    end
    properties (Access = private)
%         in;
%         b;bb;
%         original;
%         g;m;f;image=imread('done.jpg')
%         Property9 % Description
        a;
        device;
         f; 
    end
    methods (Access = private)
    end
    % Callbacks that handle component events
    methods (Access = private)
        % Code that executes after component creation
        function startupFcn(app)
        end
        % Button pushed function: startButton
        function startButtonPushed(app, event)
            set(app.samplerateEditField, 'enable', 'off')
            set(app.portEditField, 'enable', 'off')
            set(app.timeEditField, 'enable', 'off')
            set(app.timeconstantEditField, 'enable', 'off')
            set(app.cutofffrequencyEditField, 'enable', 'off')
            set(app.exitationtypeSwitch, 'enable', 'off')
            set(app.dummytestButton,'enable','Off')
            set(app.clipSwitch,'enable','Off')
            Fs=app.samplerateEditField.Value;
            t=app.timeEditField.Value;
            tc=app.timeconstantEditField.Value;
            lf=app.cutofffrequencyEditField.Value;
            Ns=Fs*t;                             %Freq. In rad.
            app.f = Fs *(0:Ns-1)/Ns;                 %Freq. In Hz.
            tt=linspace(0,t,Ns);
            c=0;
            device=serialport(app.portEditField.Value,2000000);
            pause(2);
            write(device,string(Fs)+','+string(t)+'S','string')
            for ii=1:Ns
                a=readline(device);
                a1(ii,1)=str2double(a);
            end
            switch(app.clipSwitch.Value)
                case 'auto'
                    switch(app.earthgravityKnob.Value)
                        case '-g'
                            a1=(a1+225)/225;
                            for ii=1:Ns %adxl345
                                if ((a1(ii)>=0.5 || a1(ii)<=-0.5) && c==0)
                                    a3=a1(ii:Ns);c=1;
                                end
                            end
                        case '0'
                            a1=(a1-15)/225; %adxl345
                            for ii=1:Ns %adxl345
                                if ((a1(ii)>=0.5 || a1(ii)<=-0.5) && c==0)
                                    a3=a1(ii:Ns);c=1;
                                end
                            end
                        case '+g'
                            a1=(a1-225)/225;
                            for ii=1:Ns %adxl345
                                if ((a1(ii)>=0.5 || a1(ii)<=-0.5) && c==0)
                                    a3=a1(ii:Ns);c=1;
                                end
                            end
                    end
                case 'manual'
                    figure(1);plot(a1)
                    [ii, ~]=ginput(1);close
                    switch(app.earthgravityKnob.Value)
                        case '-g'
                            a1=(a1+225)/225;
                        case '0'
                            a1=(a1-15)/225; %adxl345
                        case '+g'
                            a1=(a1-225)/225;
                    end
                    a3=a1(floor(ii):Ns);
            end
            a3(length(a3):Ns)=0;
            app.EditField.Value=app.EditField.Value+1;
            app.in=app.EditField.Value;
            switch (app.exitationtypeSwitch.Value)
                case 'impulse'
                    win=exp(-tt/tc);
                    win=win.';
                case 'continuous'
                    win=window(@hann,Ns);
            end
            a2=a3.*win;
            app.original(:,app.in)=a1;
            app.b(:,app.in)=lowpass(a2,lf,Fs);
            app.bb(:,app.in)=fft(app.b(:,app.in));
            app.g(:,app.in)=app.bb(:,app.in).*conj(app.bb(:,app.in));
            plot(app.UIAxes_2,tt,a1)
            plot(app.UIAxes_3,tt,app.b(:,app.in));
            semilogy(app.UIAxes_4,app.f,(app.g(:,app.in)));xlim(app.UIAxes_4,[0 lf]);
            switch (app.in)
                case 1
                    semilogy(app.UIAxes_5,app.f,(app.g));xlim(app.UIAxes_5,[0 lf]);
                case 2
                    semilogy(app.UIAxes_6,app.f,(app.g(:,app.in)));xlim(app.UIAxes_6,[0 lf]);
                case 3
                    semilogy(app.UIAxes_7,app.f,(app.g(:,app.in)));xlim(app.UIAxes_7,[0 lf]);
                case 4
                    semilogy(app.UIAxes_8,app.f,(app.g(:,app.in)));xlim(app.UIAxes_8,[0 lf]);
                case 5
                    semilogy(app.UIAxes_10,app.f,(app.g(:,app.in)));xlim(app.UIAxes_10,[0 lf]);
                case 6
                    semilogy(app.UIAxes_11,app.f,(app.g(:,app.in)));xlim(app.UIAxes_11,[0 lf]);
                case 7
                    semilogy(app.UIAxes_12,app.f,(app.g(:,app.in)));xlim(app.UIAxes_12,[0 lf]);
                case 8
                    semilogy(app.UIAxes_13,app.f,(app.g(:,app.in)));xlim(app.UIAxes_13,[0 lf]);
                case 9
                    semilogy(app.UIAxes_14,app.f,(app.g(:,app.in)));xlim(app.UIAxes_14,[0 lf]);
                case 10
                    semilogy(app.UIAxes_15,app.f,(app.g(:,app.in)));xlim(app.UIAxes_15,[0 lf]);
            end
            app.UITable.Data=app.original;
            app.UITable_2.Data=app.b;
            app.UITable_4.Data=app.g;
            set(app.finishButton,'enable','on')
            set(app.notacceptableButton,'enable','on')
            set(app.clearButton,'enable','on')
        end
0 个评论
回答(1 个)
  Kevin Holly
    
 2022-10-18
        
      编辑:Kevin Holly
    
 2022-10-18
  
      Have you tried to change 
properties (Access = private)
to
properties (Access = public)
to see if the property variable f can be recognized?
0 个评论
另请参阅
类别
				在 Help Center 和 File Exchange 中查找有关 Develop Apps Using App Designer 的更多信息
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

