MATLAB: The value assigned to variable ‘total’ might be unused matlab functionmean function ret = Mean(Set) total = 0; for i = 1:length(Set) total += Set(i); end ret = total / length(Set); end Best Answer This line is not a valid Matlab syntaxtotal += Set(i);You need to change it to:total = total + Set(i); Related SolutionsMATLAB: Set a variable equal to the count numel() MATLAB: “Function might be unused” I don't see any problems, unless you defined the function inside your main script, and MATLAB doesn't allow that.hfg=930;lhv=21500;p_percent=100;p=p_percent/100;MFfr=0.5191;SMfr=Ideal_Boiler(p,hfg,lhv,MFfr)disp('SMfr =');disp(SMfr)SMfr = 12.0007SMfr = 12.0007 Related QuestionComplex number determinationValue assigned to the variable might be unused.How do you finish this for loop? It is telling me to define the variable “total”, but what do I put in order for it to flow with the loopThe Value assigned to variable ‘C’ might be unused?
Best Answer