Change the sign of column of imported file in matlab.

조회 수: 3 (최근 30일)
SAYED RAZVI
SAYED RAZVI 2021년 1월 1일
답변: Ameer Hamza 2021년 1월 1일
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?

답변 (1개)

Ameer Hamza
Ameer Hamza 2021년 1월 1일
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

카테고리

Help CenterFile Exchange에서 Workspace Variables and MAT-Files에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by