"Matrix dimensions must agree" getting error

feat_indic=feat_indic|(feat_ranking_groups2==lld_groups);
feat_indic 1x6373
feat_ranking_groups2 65x1
lld_groups 6373x1

1 comentario

Walter Roberson
Walter Roberson el 9 de Mayo de 2019
What size of results are you expecting from the == between two matrices of different sizes?

Respuestas (2)

KSSV
KSSV el 9 de Mayo de 2019
Read about ismember
idx = ismember(lld_groups,feat_ranking_groups2) ;
feat_indic=feat_indic|(idx);
Walter Roberson
Walter Roberson el 9 de Mayo de 2019
feat_indic = feat_indic | ismember(lld_groups.', feat_ranking_groups2);
The .' is there to compensate for the fact that your indic is a row vector but your groups is a column vector.

La pregunta está cerrada.

Preguntada:

el 9 de Mayo de 2019

Cerrada:

el 20 de Ag. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by