How do I alternate the sign in an 1*n array?

2 次查看(过去 30 天)
For example: turn A= [ 12, 1, 10, 33] into B = [12, -1, 10, -33] Thanks for sparing time for a beginner

采纳的回答

Matt J
Matt J 2014-1-26
B=A;
B(2:2:end)=-B(2:2:end);

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Graphics Object Identification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by