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?

 採用された回答

the cyclist
the cyclist 2016 年 5 月 23 日

0 投票

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

その他の回答 (0 件)

カテゴリ

製品

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by