Function does not return all declared outputs
이전 댓글 표시
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
Walter Roberson
2021년 6월 21일
Please show an example of evaluating it.
It would help to have your two .fis files to test with.
Artur Bogdanowicz
2021년 6월 21일
Walter Roberson
2021년 6월 21일
You can zip other kinds of files and attach the .zip
Artur Bogdanowicz
2021년 6월 21일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Scope Variables and Generate Names에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!