Change from 1 to -1

조회 수: 2 (최근 30일)
Offroad Jeep
Offroad Jeep 2016년 5월 16일
댓글: Offroad Jeep 2016년 5월 17일
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....
Offroad Jeep
Offroad Jeep 2016년 5월 17일

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by