Effacer les filtres
Effacer les filtres

How to Shorten This Logical Expression?

3 vues (au cours des 30 derniers jours)
Rightia Rollmann
Rightia Rollmann le 14 Août 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 ;

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 14 Août 2016
A = ismember(B,[1 2 3 7])

Plus de réponses (1)

Image Analyst
Image Analyst le 14 Août 2016
How about
A = B <= 3 | B == 7 ;

Catégories

En savoir plus sur Graph and Network Algorithms dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by