Change from 1 to -1
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Offroad Jeep
il 16 Mag 2016
Commentato: Offroad Jeep
il 17 Mag 2016
Hi to all , I have a Matrix A = ones(5). How i can change the element value one by one to -1.
example A = [1,1,1]
A = [-1,1,1] A = [-1,-1,1] A = [-1,-1,-1]
But I want to do it for 5 X 5 matrix
Regards
0 Commenti
Risposta accettata
James Tursa
il 16 Mag 2016
Modificato: James Tursa
il 16 Mag 2016
Do you mean iteratively in a loop? E.g., changing elements one at a time in column order:
n = numel(A);
for k=1:n
A(k) = -1;
% Use A here
end
2 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Multidimensional Arrays in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!