Hi to all the users, I have tried a code in which numbers are changed from 1 to -1 turn by turn. But I need some condition.
- All elements are 1
- A random element of matrix is selected and changed from 1 to -1.
- The process goes till all the elements are changed from 1 to -1 randomly.
- Once the change happens it should be fixed. ie once 1 is changed to -1 it should remain fixed.
Hope i have cleared my idea.....
nrows = 3
A = ones(nrows)
E_A = sum(sum(A))
n = numel(A);
A(k) = -1
E_B = sum(sum(A))