How to get rid of Warning"Unexpected use of '[' in a scalar context."
46 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
a part of the function has:
if the input A (a vector) matches what is stated, the statement runs.
if A == [1,3,3]
% statement
end
and it gives me this error: 'Unexpected use of '[' in a scalar context. How can I fix this?
3 Commenti
Risposta accettata
Più risposte (1)
KSSV
il 13 Ago 2018
When you use A == [1 3 3] ;
With this operator ==, MATLAB expects a scalar value, but the way used here, it gives array as output. So the warning pops out. The way you use, won't work out. YOu need to use the operator == with a scalar value, so the if condition works fine.
5 Commenti
Vedere anche
Categorie
Scopri di più su Scope Variables and Generate Names in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!