フィルターのクリア

what does ismember actually mean?

2 ビュー (過去 30 日間)
Muazma Ali
Muazma Ali 2019 年 9 月 25 日
コメント済み: dpb 2019 年 9 月 27 日
S={'NH4Cl'; 'MgCl2'; 'CaCl2'; 'ZnCl2'; 'ZnSO4'; 'NaCl'};
str={'Choose the combinations of salts available'};
result=listdlg('Promptstring',str, 'ListSize', [100,100], 'ListString', S, ...
'SelectionMode', 'multiple');
if all(ismember(result,[1 3]))
disp('hei')
end
in this code (all (ismember...), does the chronology of user's choice has to say anything or does ismember mean that user could have chosen the item 1 first and then 3 or 3 first and then 1? asking because then I have to take this into account in the if statement
  1 件のコメント
dpb
dpb 2019 年 9 月 27 日
The logical vector returned by ismember is relative to the members in the first argument in the call -- in your case the array result. However, as you've written it with all, the condition will only be true if the user selects both 1 and 3 from the dialog box -- probably not what you're after.

サインインしてコメントする。

採用された回答

Star Strider
Star Strider 2019 年 9 月 25 日
If I understand your Question correctly, the logical vector created by ismember will be in the order the elements appear in ‘result’. However that is likely irrelevant because you are calling the all function. So either they both match (the all condition will be true) or one or none match (the all condition will be false).

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeEnumerations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by