Filter löschen
Filter löschen

How to Shorten This Logical Expression?

3 Ansichten (letzte 30 Tage)
Rightia Rollmann
Rightia Rollmann am 14 Aug. 2016
Beantwortet: Azzi Abdelmalek am 14 Aug. 2016
What is the best way to rewrite A in the shortest way?
B = 1:14;
A = B == 1 | B == 2 | B == 3 | B == 7 ;

Akzeptierte Antwort

Azzi Abdelmalek
Azzi Abdelmalek am 14 Aug. 2016
A = ismember(B,[1 2 3 7])

Weitere Antworten (1)

Image Analyst
Image Analyst am 14 Aug. 2016
How about
A = B <= 3 | B == 7 ;

Kategorien

Mehr zu Graph and Network Algorithms finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by