Borrar filtros
Borrar filtros

Change from 1 to -1

1 visualización (últimos 30 días)
Offroad Jeep
Offroad Jeep el 16 de Mayo de 2016
Comentada: Offroad Jeep el 17 de Mayo de 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

Respuesta aceptada

James Tursa
James Tursa el 16 de Mayo de 2016
Editada: James Tursa el 16 de Mayo de 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 comentarios
Offroad Jeep
Offroad Jeep el 16 de Mayo de 2016
Editada: Offroad Jeep el 16 de Mayo de 2016
Thanks for help, that great. You have put a foundation stone in my simulation...... Thanks again and will like if we work together....
Offroad Jeep
Offroad Jeep el 17 de Mayo de 2016

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Multidimensional Arrays en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by