To resolve issues starting MATLAB on Mac OS X 10.10 (Yosemite) visit: http://www.mathworks.com/matlabcentral/answers/159016
Now i combined answers. Help me about this iteration. I want it iterate until whole matrix zero.
if ~sum(A(:)) % this iteration will be continued until whole matrix zero 0
f = find(any(A==-1,2)); % i have to find row which including only one -1, if found 2 or more, i have to pick just one of them in that iteration. How can i find it?
% in one column only one -1 and 1. then after find row with only one -1, i have to add it to the row with 1 which is staying with one column. It is the way my matrix will be zero.
2nd row which including only one -1 is added to the first row. after that:
If all whole matrix not zero. then will be iterated again. Please give me some clue. Help me!
Thank you for ADVICE!
No products are associated with this question.
while true if (the ending condition is met) break end rownum = index of one row that has exactly one -1 neg1idx = column index of -1 in row number rownum plus1rownum = row index of row that has +1 in column number negidx A(plus1rownum,:) = A(plus1rownum,:) + A(rownum, :); end
It is, however, highly recommended that you add protections in case the input matrix is not structured the way you expect.