How to assign numbers
3 次查看(过去 30 天)
显示 更早的评论
Hi all I have got a table where I want to assign number bigger than the highest number already there in the table to the ones assigned zero. How can I do that.
5 个评论
Guillaume
2019-8-6
@madhan,can you write that as an answer? I don't think it can be done any simpler.
采纳的回答
更多回答(1 个)
Joel Handy
2019-8-6
Something like this?
table = randi([0 10],10,10);
tableMax = max(max(table));
table(table==0) = tableMax+1;
% Or Just
table(table==0) = Inf;
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!