Cell contents reference from a non-cell array object error

3 visualizzazioni (ultimi 30 giorni)
Error: Cell contents reference from a non-cell array object. I know that a input must be a cell array but thin is I don't know where went wrong when I put in a cell array...
Here's the code:
function subset = GetClassSubsetIndexes(classes)
subset=[];
oldClassLabel = 'nekaLabela';
for i=1 : 1 : length(classes)
if oldClassLabel ~= classes{i}
oldClassLabel = classes{i};
subset = cat(1, subset, i);
end
end
%now put end indicies
for i=2 : 1 : size(subset,1)
endIndex = subset(i, 1);
subset(i-1, 2) = endIndex-1;
end
subset(size(subset,1), 2) = length(classes);
end
Need help Thanks!!! Ps: please don't close the question, it's quite important to me...
  4 Commenti
Lester Lim
Lester Lim il 23 Gen 2013
For == it gives the same error, class(classes) gives the following error: For colon operator with char operands, first and last operands must be char.
Walter Roberson
Walter Roberson il 23 Gen 2013
if ~strcmp(oldClassLabel, classes{i})
The bit about colon operators makes no sense unless the class() call itself has been shadowed.
Right after the "function" line, for the moment please put
which -all class
whos classes
and show us the output.

Accedi per commentare.

Risposta accettata

Walter Roberson
Walter Roberson il 23 Gen 2013
Your code is written to assume that LDA is called with the second parameter being a cell array of strings, but you are instead calling it with the second parameter being a column vector of double (such as a class number.)
  38 Commenti
Lester Lim
Lester Lim il 24 Gen 2013
Got another problem, hoping you could help, the dimensions don't agree but the double works. The testSample is supposed to be the picture I want to classify right?
Lester Lim
Lester Lim il 24 Gen 2013
Also, the new problem is none other than out of memory...Im crying...

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by