Change the sign of column of imported file in matlab.
4 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
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
0 个评论
另请参阅
类别
在 Help Center 和 File 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!