Binary value convert.
1 次查看(过去 30 天)
显示 更早的评论
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];
0 个评论
采纳的回答
Ameer Hamza
2021-1-2
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 个评论
Image Analyst
2021-1-2
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
2021-1-2
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!