Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
Amar
Amar le 26 Jan 2014
Réponse apportée : Matt J le 26 Jan 2014
For example: turn A= [ 12, 1, 10, 33] into B = [12, -1, 10, -33] Thanks for sparing time for a beginner

Réponse acceptée

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

Plus de réponses (0)

Catégories

En savoir plus sur Graphics Object Identification dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by