Change the certain element after comparison of two arrays

조회 수: 1 (최근 30일)
Maksim Tiurin
Maksim Tiurin 2019년 6월 13일
답변: Joel Handy 2019년 6월 13일
there is a string of 8 numbers, and a string filled with zeros (of the same length). I need to check the first string for the presence of zeros in it, and if there is a zero there, then it is necessary that in the second string the same element is changed to 1.
For example
B = [0 0 0 0 0 0 0 0]
A = [1 2 3 4 5 6 7 0]
then check A for the presence of zeros and change B to the B = [0 0 0 0 0 0 0 1]
Perhaps this is a stupid question, but I have not yet found an answer, please help.

채택된 답변

Joel Handy
Joel Handy 2019년 6월 13일

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by