Effacer les filtres
Effacer les filtres

Undefined variable "numel" or class "numel"

1 vue (au cours des 30 derniers jours)
Talent Mukaro
Talent Mukaro le 16 Juin 2020
Commenté : Talent Mukaro le 16 Juin 2020
Hie, how can i solve the above error in this code as below;
repelem = {};
for ii = 1:numel{subset}
subsetLabels{ii} = repelem{{subset{ii}.Description},subset{ii}.Count,1};
end
subsetLabels = vertcat(subsetLabels{:});
%nume1 = {};
togglefig('Sample Images',1)
[hpos,hdim] = distributeObjects(numel(subset),0.05,0.95,0.01);
[vpos,vdim] = distributeObjects(3,0.95,0.05,0.025);
ax = gobjects(numel(subset),1);
[hind,vind] = meshgrid(1:numel(imgSet),1:subset(1).Count);
for ii = 1:numel(subsetNames)
ax(ii) = axes('Units','Normalized',...
'Position',...
[hpos(hind(ii)) vpos(vind(ii)) hdim vdim]);
imshow(subsetNames{ii});
title(subsetLabels{ii},'fontsize',12)
end
expandAxes(ax);
  2 commentaires
Gautam
Gautam le 16 Juin 2020
for ii = 1:numel{subset} ------------------>>> change the bracket i.e numel(subset)
Talent Mukaro
Talent Mukaro le 16 Juin 2020
thank you Sir. that error resolved. Here is another error;
repelem = {};
for ii = 1:numel(subset)
subsetLabels{ii} = repelem{{subset(ii).Description},subset(ii).Count,1};
end
subsetLabels = vertcat(subsetLabels{:});
The error is;
Matrix indices must be full double.
Error in SignLive (line 19)
subsetLabels{ii} = repelem{{subset(ii).Description},subset(ii).Count,1};

Connectez-vous pour commenter.

Réponse acceptée

madhan ravi
madhan ravi le 16 Juin 2020
numel(subset)
  1 commentaire
Talent Mukaro
Talent Mukaro le 16 Juin 2020
thank you Sir. that error resolved. Here is another error;
repelem = {};
for ii = 1:numel(subset)
subsetLabels{ii} = repelem{{subset(ii).Description},subset(ii).Count,1};
end
subsetLabels = vertcat(subsetLabels{:});
The error is;
Matrix indices must be full double.
Error in SignLive (line 19)
subsetLabels{ii} = repelem{{subset(ii).Description},subset(ii).Count,1};

Connectez-vous pour commenter.

Plus de réponses (1)

Walter Roberson
Walter Roberson le 16 Juin 2020
for ii = 1:numel{subset}
That requests that a variable named numel is indexed as a cell array, at offset subset
subsetLabels{ii} = repelem{{subset{ii}.Description},subset{ii}.Count,1};
That requests that a variable named repelem be indexed as a cell.
In MATLAB, the {} operators are used for creating cell arrays, and for indexing "inside" cell arrays, string objects, table objects, and a few other kinds of object.
ax = gobjects(numel(subset),1);
That requests that the numel function be executed on the content of the variable subset . That looks quite reasonable to do.
A function name with () after it indicates invoking a function.
An array with () after it indicates indexing into the array. This is the same () appearance as for functions being invoked, so they can be confused at first glance.
This line of code asks to invoke numel on subset, and then it takes the result of that and takes the constant 1, and uses them as parameters to invoke the gobjects function.
numel{subset}
Not likely to work. You probably do not have a variable named numel to index into. More likely is that you want to invoke numel function on subset, just like you did on constructing ax
  1 commentaire
Talent Mukaro
Talent Mukaro le 16 Juin 2020
thank you Sir. now this is the new error
Index exceeds matrix dimensions.
Error in SignLive (line 19)
subsetLabels(ii) = repelem((subset(ii).Description),subset(ii).Count,0);

Connectez-vous pour commenter.

Catégories

En savoir plus sur Matrices and Arrays dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by