How to suppress the ans in a user defined function
3 次查看(过去 30 天)
显示 更早的评论
I have a function that identifies the max value of every column, then every row and the max value of the entire matrix itself.
However, whenever I run the code with a given matrix, it produces ans with the values assigned to every column, how do I suppress this?
This is my code.
function[mc,mr,mm] = MyMax_1(A)
mc = max(A);disp('maxcolumns'),disp(mc)
mr = max(A.');disp('maxrows'),disp(mr.')
mm = max(max(A));disp('maxmatrix'),disp(mm)
end
0 个评论
采纳的回答
Scott
2014-4-16
When you call MyMax_1(A), add a semi-colon to the end of that line e.g.
x=[1,2,3;4,5,6];
MyMax_1(x);
maxcolumns
4 5 6
maxrows
3
6
maxmatrix
6
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!