Change from 1 to -1

1 次查看(过去 30 天)
Offroad Jeep
Offroad Jeep 2016-5-16
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

采纳的回答

James Tursa
James Tursa 2016-5-16
编辑:James Tursa 2016-5-16
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 个评论
Offroad Jeep
Offroad Jeep 2016-5-16
编辑:Offroad Jeep 2016-5-16
Thanks for help, that great. You have put a foundation stone in my simulation...... Thanks again and will like if we work together....

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Programming 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by