Made a small script in which we pick 2 random numeric elements from the "box" (array with "0"s and "1"s). I want to make further steps depending on the sum of these elements, however Matlab doesn't execute the script with the following mistake (see the screenshot). Script proceeds with ">" and "<", but not "="

 Réponse acceptée

Sean de Wolski
Sean de Wolski le 1 Juin 2016

1 vote

one = is an assignment, two = is a test of equality
if sum(x) == 1
will fix this.

1 commentaire

Vasilyi Troshkin
Vasilyi Troshkin le 1 Juin 2016
thx, did this the 2d time and it worked I tried this before but somehow it didn't help

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Centre d'aide et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by