Unable to perform assignment because brace indexing is not supported for variables of this type.
Mostrar comentarios más antiguos
Dear Matlab Community,
in a loop I am trying to write variables into a cell.
For variable sub_matrix it works, however for sub_matrix_idx it does not.
The error message:Unable to perform assignment because brace indexing is not supported for variables of this type.
The former are pixel values of an image in double format, the latter returns the position of these pixels on the image (also double, please see attached).
Any suggestions are appreciated
best
lg
5 comentarios
Matt J
el 10 de En. de 2023
We need to see a demonstration of what you did, which you can provide using the Run button

Levente Gellért
el 10 de En. de 2023
Editada: Matt J
el 10 de En. de 2023
Walter Roberson
el 10 de En. de 2023
Which line is the error occurring on?
Levente Gellért
el 10 de En. de 2023
Image Analyst
el 10 de En. de 2023
What does this show
whos sub_matrix
whos sub_matrices
I ran your code, drew a region, and it finished with no error. I tried several time.
But what are you trying to do? In words, rather than code. There might be a better way.
I attach some demos that might help.
Respuesta aceptada
Más respuestas (2)
Ryan Baird
el 10 de En. de 2023
It looks like sub_matrix is a matrix rather than a cell array, so it should be accessed with parenthesis:
sub_matrix(i, j) = ...
and not with braces:
sub_matrix{i, j} = ...
Levente Gellért
el 11 de En. de 2023
0 votos
Categorías
Más información sobre Creating and Concatenating Matrices en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!