Can I supress an 'ans' output without making a void function?
Show older comments
function[ Hours Minutes Seconds Message ] = TimeConversion(TotalSeconds);
Hours = floor(TotalSeconds/3600);
Minutes = floor((TotalSeconds-(Hours*3600))/60);
Seconds = TotalSeconds-Hours*3600-Minutes*60;
Message = [num2str(TotalSeconds) ' Second(s) is equal to '... num2str(Hours) ' hour(s), ' ... num2str(Minutes) ' minute(s), and ' ... num2str(Seconds) ' second(s).'];
disp(Message);
end
When I Run this code:
>> TimeConversion(51624)
51624 Second(s) is equal to 14 hour(s), 20 minute(s), and 24 second(s).
ans =
14
Is there a way to suppress the ans?(which is obviously referencing 'Hours'), but keep the array in the function output for things such as: "[out1, out3] = TimeConversion(82000)"
Accepted Answer
More Answers (1)
A Jenkins
on 22 Sep 2014
Use a semicolon.
TimeConversion(51624);
or
[out1, out3] = TimeConversion(82000);
Categories
Find more on Startup and Shutdown 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!