Summon Exit parameters from a function in MATLAB App Designer

32 Views Asked by At

H

Hi. I have the following code in a program that i'm making in App Designer (MATLAB).

methods (Access = private)

    %//////////////////// FUNCIONES /////////////////////////////////
    function results = Monopolo(app,F,U,a,r)
        % CALULO DE Pa y SPL DEL MONOPOLO
        F = F;
        U = U;
        a = a;
        r = r;
        % Propiedades del medio.
        Po = app.EditField_density.Value; % Kg/m^3
        Co = app.EditField_velocity.Value; % m/s
        %///////////////// Calculo de los datos ///////////////////////

        w = 2*pi*F;
        k = w/Co;
        ka = k*a;

        x = ( k*(r-a) )* (pi/180);
        m = (w*Po*U)/(4*pi*r);
        n = 1 + (ka)^2;

        % Evaluar datos en la expresión general.

        P = complex ( (m/n)*(ka*cos(x)+sin(x)) , (m/n)*(cos(x)-ka*sin(x)) );
        P_Pa = abs(P); % Pascales
        SPL = 20*log10(P_Pa/(20*10^-6)); % dB

        disp(SPL)
        % Parametros de salida de la función.
        results = SPL;

    end
end

I have a function called Monopolo. My input parameters are F,U,a and r. After all the calculation my exit parameter is SPL. I want to call this parameter later on my code. However i'm having problems in making this parameter an exit from the function and I dont find the syntaxis to call this exit.

0

There are 0 best solutions below