How to compare blank spaces in arrays?
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello every one, I'm working on a little project on app designer where I need to do something like this:
Say I have two arrays of strings of the same size but the second has some 'blanks' as follows:
a=["red","blue","green","yellow"];
b=["orange","","","purple"];
How can I get a new array 'c' with the words from array 'a' that are at the same position as `blanks' in array 'b'?
the result would be:
c=["blue","green"];
Thanks for reading!
댓글 수: 0
답변 (1개)
Jonas
2022년 11월 28일
use this
a=["red","blue","green","yellow"];
b=["orange","","","purple"];
c=a(b=="")
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Cell Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!