Change the sign of column of imported file in matlab.

6 vues (au cours des 30 derniers jours)
SAYED RAZVI
SAYED RAZVI le 1 Jan 2021
I have the data which is imported from notepad to matlab. it contains 2 columns and too many rows. one column of it is in negative which needs to be change its sign. Now how to change the sign of the entire column after impoteing the data in MATLAB?

Réponses (1)

Ameer Hamza
Ameer Hamza le 1 Jan 2021
Something like this
M_new = M.*[-1 1]; % change sign of 1st column
M_new = M.*[1 -1]; % change sign of 2nd column
or
M_new = M*[-1 0; 0 1]; % change sign of 1st column
M_new = M*[1 0; 0 -1]; % change sign of 2nd column

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by