Why is Matlab returning "Unbalanced or unexpected parenthesis or bracket."?
1 view (last 30 days)
Show older comments
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
on 5 May 2015
Inside the curly brackets, the left and right parentheses don't balance. Also outside they don't balance.
Accepted Answer
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.
2 Comments
Md Mahmudul Hasan
on 9 Sep 2020
for i=min(find(time>=2.0)):length(u)
u(i) = 0.5;
end
%please help me to solving the error
Walter Roberson
on 9 Sep 2020
Edited: Walter Roberson
on 9 Sep 2020
does your actual code have & ?
More Answers (0)
See Also
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!