how to check each value of matrix
1 次查看(过去 30 天)
显示 更早的评论
let
a = [1,2,3;4,5,6;7,8,9]
b = 1
c = b-a
if an element of 'a' becomes 0 after c operation it should be fixed i.e. on first operation
c = [0,1,2;3,4,5;6,7,8]
now output should be , 1 of first output should be fixed and
c = [1,2,3;4,5,6;7,8,9]
c = [1,1,2;3,4,5;6,7,8]
c = [1,1,1;2,3,4;5,6,7]
............... and so on
0 个评论
回答(2 个)
Stephen23
2015-9-28
Note that you can generate every output of your example in one command, where each row corresponds to one output:
>> toeplitz(ones(1,9),1:9)
ans =
1 2 3 4 5 6 7 8 9
1 1 2 3 4 5 6 7 8
1 1 1 2 3 4 5 6 7
1 1 1 1 2 3 4 5 6
1 1 1 1 1 2 3 4 5
1 1 1 1 1 1 2 3 4
1 1 1 1 1 1 1 2 3
1 1 1 1 1 1 1 1 2
1 1 1 1 1 1 1 1 1
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Entering Commands 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!