I have a numerical vector made of ones and zeros. I would like to switch the ones and the zeros. I tried by creating a new vector vector_6 = vector_5 and then vector_6(0==1) but it gave me back an empty vector. What am I doing wrong?

 Akzeptierte Antwort

the cyclist
the cyclist am 23 Mai 2016

0 Stimmen

A = [1 0 1 0 1];
A = 1-A;

Weitere Antworten (0)

Kategorien

Mehr zu Aerospace Blockset finden Sie in Hilfe-Center und File Exchange

Produkte

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by