How to ensure that the value in my mxn matrix does not exceed certain value?

1 回表示 (過去 30 日間)
Mei Sing Wang
Mei Sing Wang 2020 年 6 月 24 日
回答済み: KSSV 2020 年 6 月 24 日
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.

回答 (1 件)

KSSV
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

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by