Function does not return all declared outputs
Show older comments
The following function has three declared outputs. Although each output is correctly calculated, function returns only output variable #1 in the row (verified by changing position of the variables), like there would be only one output variable declared.
----
function [rRollAltAgl, rPitchAltAgl, rRollIas] = evRisk(raw_vector)
%raw_vector = input(prompt);
roll = raw_vector(1);
pitch = raw_vector(2);
ias = raw_vector(3);
altAGL = raw_vector(4);
% ----rRoll_AltAGL Calculation
rRollAltAgl = evalfis(fisStructRoll_AltAGL,[roll altAGL]);
% ----rPitch_AltAGL Calculation
rPitchAltAgl = evalfis(fisStructPitch_AltAGL,[pitch altAGL]);
% ----rRoll_IAS Calculation
% Roll_IAS Excess Over Stall
rollRad = roll*(pi/180); % bank in degrees to radians
GInc = sec(rollRad); % load increase (roll secans)
stallIAS = 72; % stall speed clean config
stallInc = stallIAS * sqrt(GInc); % stall speed increase
iasExc = ias/stallInc; % excess of speed over stall speed
rollIASOutput = (iasExc-1)*100; % value for calculations
% Roll_IAS Risk Assement
if rollIASOutput > 50
rRollIas = 10;
elseif rollIASOutput > 45
rRollIas = 20;
elseif rollIASOutput > 40
rRollIas = 30;
elseif rollIASOutput > 35
rRollIas = 40;
elseif rollIASOutput > 30
rRollIas = 50;
elseif rollIASOutput > 25
rRollIas = 60;
elseif rollIASOutput > 20
rRollIas = 70;
elseif rollIASOutput > 15
rRollIas = 80;
else
rRollIas = 90;
end
end
function Roll_AltAGL_4C = fisStructRoll_AltAGL(~)
Roll_AltAGL_4C = getFISCodeGenerationData('Roll_AltAGL.fis');
end
function Pitch_AltAGL_4C = fisStructPitch_AltAGL(~)
Pitch_AltAGL_4C = getFISCodeGenerationData('Pitch_AltAGL.fis');
end
4 Comments
Walter Roberson
on 21 Jun 2021
Please show an example of evaluating it.
It would help to have your two .fis files to test with.
Artur Bogdanowicz
on 21 Jun 2021
Walter Roberson
on 21 Jun 2021
You can zip other kinds of files and attach the .zip
Artur Bogdanowicz
on 21 Jun 2021
Accepted Answer
More Answers (0)
Categories
Find more on Scope Variables and Generate Names in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!