Q: How to solve Output argument when it's not assigned into program for sub function The drinking water standard for iron is 0.3mg/L. Similarly, the standard for magnesium is 0.05mg/L. Create a program that will take in the measured values of iron and magnesium and display whether the water is safe to drink.
I have started the program that is testing Iron first and then will create another program testing for Magnesium. My issue is that I have to use sub-functions to solve the program and I get the correct answer however an error follows in the command window. I know that it has to involve test=testWater(IronSafe) because I haven't declared my output statement and I'm not sure how to implement it into my code. 
function [IronStand] = ProblemWATER(IronSafe)
%Create a function that states whether H20 for iron is safe to drink
% 1 inputs: IronSafe
% 1 output:IronStand 
IronSafe = input('What is the density level of your iron \n');
IronStand = testWater(IronSafe);
end
function test= testWater(IronSafe)
%Subfunction meant to determine if IronStand drinkable
IronStand = 0.3;
if IronSafe == IronStand
    disp('Safe to drink'); 
else 
    disp('Not safe');
end
end

My Command Window displays:


A: The problem is in your second function function test= testWater(IronSafe). You are returning the value test but never assigning it to anything. You can solve it by removing it:
function [] = ProblemWATER(IronSafe)
%Create a function that states whether H20 for iron is safe to drink
% 1 inputs: IronSafe
% 1 output:IronStand 
IronSafe = input('What is the density level of your iron \n');
testWater(IronSafe);
end

function [] = testWater(IronSafe)
%Subfunction meant to determine if IronStand drinkable
IronStand = 0.3;
if IronSafe == IronStand
    disp('Safe to drink'); 
else 
    disp('Not safe');
end
end

If you want the value of IronStand back then you need to change the return value:
function [IronStand] = ProblemWATER(IronSafe)
%Create a function that states whether H20 for iron is safe to drink
% 1 inputs: IronSafe
% 1 output:IronStand 
IronSafe = input('What is the density level of your iron \n');
IronStand = testWater(IronSafe);
end

function [IronStand] = testWater(IronSafe)
%Subfunction meant to determine if IronStand drinkable
IronStand = 0.3;
if IronSafe == IronStand
    disp('Safe to drink'); 
else 
    disp('Not safe');
end
end

