Why is Matlab returning "Unbalanced or unexpected parenthesis or bracket."?

1 view (last 30 days)
Hello, I am trying to code a program where the background changes color about every minute. In this expression:
background = backgrounds{mod(Bg_state,numel(backgrounds)}+1);
the number of beginning and end parenthesis and curly brackets are the same. Does this have something to do with bracket syntax? Thank you for your help.
  1 Comment
Roger Stafford
Roger Stafford on 5 May 2015
Inside the curly brackets, the left and right parentheses don't balance. Also outside they don't balance.

Sign in to comment.

Accepted Answer

Jan
Jan on 5 May 2015
Edited: Jan on 5 May 2015
The parenthesis overlap:
background = backgrounds{ mod(Bg_state,numel( backgrounds ) } + 1);
{ }
( )
It is not only the number of braces and parenthesis, but the must be closed in the right order also.

More Answers (0)

Categories

Find more on Matrices and Arrays in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!