MATLAB Answers

Converting positives to negatives in a column.

36 views (last 30 days)
I have somewhat of a confusing problem that I need help with. I am going to explain it the best that I can, so here goes. I have two column vectors, one is Cp the others is Cf. The Cp column has positive values and some negative values. I basically need to take the rows in the Cp column that are negative and make the same rows of Cf negative. For example:
Then the new column vector would be:
Basically making any negative row in Cp, negative in Cf.
Is there any easy way to do this? Any help is much appreciated.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!