My function is only giving me one output
Show older comments
function[BeamWeightN,BeamWeightN_X,FB_X,FB_Y,FA_Y,ErrStatus]=BeamReactions(BeamLength,BeamMass,Load,LoadX,LoadAngle)
%fprintf("check to make sure that BeamLength is in meters,BeamMass is in Kg/m, Load is in Newotns,LOadX is in meters, LoadAngle is in degrees CCW")
%BeamLength = 16; % meters
%BeamMass = 45; % Kg/m
%Load = 4800; % Newton
%LoadX = 3; % Location of Load in meters from Roller Support
%LoadAngle = 135; % CCW angle in Degrees
a=isnumeric(BeamLength);
b=isnumeric(BeamMass);
c=isnumeric(Load);
d=isnumeric(LoadX);
e=isnumeric(LoadAngle);
if a==1 && b==1 && c==1 && d==1 && e==1
BeamWeightN=BeamMass*BeamLength*9.81
BeamWeightN_X=BeamLength/2
FB_X=Load*(cosd(LoadAngle))
FB_Y=(LoadX*(Load*(sind(LoadAngle)))+(BeamLength/2)*BeamWeightN)/BeamLength
FA_Y=(Load*(sind(LoadAngle)))+BeamWeightN-FB_Y
else
ErrStatus=1;
fprintf("you have inputed a nonscalar value");
end
end
it keeps returning "ans= 7.0632e+03"
thank you
Accepted Answer
More Answers (1)
Stephen23
on 26 Mar 2018
Make sure that you call it with the correct number of output arguments, e.g.:
[BeamWeightN,BeamWeightN_X,FB_X,FB_Y,FA_Y,ErrStatus] = BeamReactions(...)
1 Comment
Welid Benchouche
on 24 Jul 2021
is there anywhay to force it to input all outputs without calling them? just with the function's name
Categories
Find more on Operators and Elementary Operations 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!