I got a problem that i think i have already answered, but it didnt work. Here is the deal:
I have a large cell array (about 300000x60) with some numeric data, some dates, some blank, some strings that I have to filter (like in Excel): For example:
m = ...
{ 'date ' 'code' 'number' 'market' 'max' 'min'
'01/01/2000' 'tsa' 1 0 0.9 0.0008
'01/01/2000' 'sje' 2 0 1.8 1.5
'01/02/2000' 'koi' 1 1 5.5 1.8
'02/01/2000' 'sjk' 2 0 5.8 3.5
'05/02/2000' 'kkj' 5 7 5.5 3.8 };
I can filter the strings ('code' column) with:
b = m(strcmp('tsa',m(:,2)),:);
and as result:
b =
'01/01/2000' 'tsa' 1 0 0.9 0.0008
(this is working perfectly).
BUT, when I tried to filter the numbers, with c=m([m{:,3}] == 1,:);
I had some strange answers in "c" (I got a cell array with all possible values in column 3, not only the ones which correspond to number '1')!
I want the answer like:
c = m([m{:,3}] == 1,:)
c =
'01/01/2000' 'tsa' 1 0 0.9 0.0008
'01/02/2000' 'koi' 1 1 5.5 1.8
can anyone help me?
Thanks in advance!
cellis a reserved function in MATLAB, do not obfuscate it by creating a variable with the same name. Also, I cannot reproduce the problem with the actual snippet of code. Consider changingcelltoCelland providing code that reproduces the issue. - Oleg