Is there a way to exclude variables from a string array after they've been chosen using menu function?
조회 수: 5 (최근 30일)
이전 댓글 표시
Materials = ["Aluminum";"Cadmium";"Iron";"Tungsten";string(newMaterial)];% newMaterial is Copper in this case
Choice1 = menu('Please choose the alloy''s first component',Materials);
Choice2 = menu('Please choose the alloy''s second component',Materials);
What I need to do is remove the variable chosen in Choice1 from the options of materials to choose in Choice2. I can't seem to find the command/function that will allow me to do this.
댓글 수: 0
채택된 답변
KSSV
2021년 9월 3일
편집: Walter Roberson
2021년 9월 3일
Read about setdiff. Or use strcmp get the position and remove the string.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!