How to switch positive/negative sign to opposite value?

121 views (last 30 days)
Hello!
I need help figuring out how to reverse the sign of every number on an excel data sheet I am importing. (I have distance moved in the West direction, I need distance moved in the East direction, starting at 0,0 so I have to switch the signs)
For example, I want to change: 0.00019, -0.00125, 0.00056 to -0.00019, 0.00125, -0.00056.
Any help is greatly appreciated! I am not proficient in MatLab and usually use it for relatively simple programs to split up my data into different time segments, so please try to explain any MatLab jargon or complicated processes.
Thank you!
Jenna

Accepted Answer

Image Analyst
Image Analyst on 1 Apr 2014
Have you tried:
T = readtable('yourWorkbook.xlsx');
T = -T;
I haven't tried it but it looks like it should work (assuming you have the latest version of MATLAB, and your data is in a rectangular table in your workbook).

More Answers (0)

Community Treasure Hunt

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

Start Hunting!