Imbedded If statement in Function help!
1 ビュー (過去 30 日間)
I am trying to write a function that allows me to add up all of my inputs given the conditions in my code. I am trying to make it so I can add it up to see what the help index is. I'm pretty sure my function code is wrong. If you can help tell me where I can fix it I would greatly appreciate it! Thank you! in advance
function [helpIndex]=needsHelp(age,duration,burden,sati); %function to calculate the helpIndex using age(yrs),duration(months),burden,and satisfaction
if age>50 % If age is greater than 50 add 1 point
elseif duration>60% If duration is greater than 60 add 1 point
elseif burden>70% If burden is greater than 70 add 1 point
elseif burden>70 && sati<50 %Then if burden is greater than 70 and satisfaction is less than 50 add an additional point.