Borrar filtros
Borrar filtros

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

2 visualizaciones (últimos 30 días)
Amar
Amar el 26 de En. de 2014
Respondida: Matt J el 26 de En. de 2014
For example: turn A= [ 12, 1, 10, 33] into B = [12, -1, 10, -33] Thanks for sparing time for a beginner

Respuesta aceptada

Matt J
Matt J el 26 de En. de 2014
B=A;
B(2:2:end)=-B(2:2:end);

Más respuestas (0)

Categorías

Más información sobre Graphics Object Identification en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by