how to check each value of matrix
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (2)
Stephen23
le 28 Sep 2015
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 commentaires
Voir également
Catégories
En savoir plus sur Entering Commands dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!