How to multiply -1 with specific vector of a matrix ?
Ältere Kommentare anzeigen
Dear all,
I would like to multiply -1 in all elements of column vector of a matrix in the following conditions: 1) if all elements of the column vectors of the matrix are negative. 2) if some elements of the column vectors are negative and rest of them are positive 3) if all elements of the column vectors are positive, don't need to multiply with -1
would you please give me some idea how can i proceed??? for example the matrix is
A=[-0.5 2 3 -5; -0.8 -7 4 6; -0.9 2 3 -9; -0.3 -6 3 1; -0.2 5 3 -7]
result should be like that Result_A=[0.5 -2 3 5; 0.8 7 4 -6; 0.9 -2 3 9; 0.3 6 3 -1; 0.2 -5 3 7]
Thanks in advance.
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!