When I try to run the following line of code, I get the error message "Error: Unbalanced or unexpected parenthesis or bracket." Although I understand the content of the error message, I cannot determine what is wrong with my syntax.

1 view (last 30 days)
When I try to run the following line of code, I get the error message "Error: Unbalanced or unexpected parenthesis or bracket." Although I understand the content of the error message, I cannot determine what is wrong with my syntax.
[row,col]=find(mat==1(mat));
Thank you.

Accepted Answer

per isakson
per isakson on 29 Nov 2012
1(mat)
is wrong. What's the intent?
  2 Comments
Emma
Emma on 29 Nov 2012
I would like to find the row/column locations of all values in a 2400x2400x46 matrix that are equal to 1 (ideally in the output format of a matrix that has the rows in one column and the corresponding columns in a second column).
Image Analyst
Image Analyst on 29 Nov 2012
It's the mat'th element of one. ;-) Maybe try this:
[row, col] = find(mat == 1);
Just trying to give you something to try in advance. Tell us if that did work (and mark this as "Answered") or else tell us what you intended.

Sign in to comment.

More Answers (0)

Categories

Find more on Creating and Concatenating Matrices 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!