I have a binary bit sequence A = [0 1 0 1;1 0 0 1; 0 0 0 1; 1 0 0 1]; How can i convert all the 0 values into -1.??
The final output will become as A = [-1 1 -1 1;1 -1 -1 1;-1 -1 -1 1;1 -1 -1 1];

 Respuesta aceptada

Ameer Hamza
Ameer Hamza el 2 de En. de 2021

0 votos

Read about logical indexing
A = [0 1 0 1;1 0 0 1; 0 0 0 1; 1 0 0 1];
A(A==0) = -1;

3 comentarios

Noman Abir
Noman Abir el 2 de En. de 2021
Thank You Bro. The process / code is working.
Bro, I need your extreme help.
Can I get your whatsapp or any kind of communication number / id please..?
Image Analyst
Image Analyst el 2 de En. de 2021
Offline private consulting is not usually done. Why can't you continue to get help here in the Answers forum, where everyone can benefit from the questions and answers?
Ameer Hamza
Ameer Hamza el 2 de En. de 2021
Yes, it is better to post your question on this forum so that you have a better chance of getting any help, and the answers will also be helpful for others.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.

Productos

Versión

R2014b

Etiquetas

Preguntada:

el 2 de En. de 2021

Comentada:

el 2 de En. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by