How to ensure that the value in my mxn matrix does not exceed certain value?
1 次查看(过去 30 天)
显示 更早的评论
How to ensure that the value in my mxn matrix does not exceed certain value?
Let say I have a 5x5 matrix, I wish to check the one in middle whether it exceed certain value....
If the value exceed then I will loop back to another condition.
0 个评论
回答(1 个)
KSSV
2020-6-24
for i = 1:2
for j = 1:2
A(i,j) = input("enter value:") ;
while A(i,j) > 2
A(i,j) = input("enter value, less than 2:") ;
end
end
end
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!