Prev: Neural Network
Next: Finding all zeros of Bivariate Polynomial system with complex number coefficients
From: Markus on 21 Jul 2010 04:29 hello i need to find an value in a partly empty cell array with different data types (incl. serial- object) and return the index of the position of the value. let's assue we have s1=serial('COM1'); s2=serial('COM2'); cellArray = {'aa' [] [] [] ; 'bb' [9600] [2] s2 }; so now i want to check, if there is a value ==9600 in column 2 i tried isEqTo = arrayfun(@(x)((x{1}==9600)),cellArray,'uniformoutput',false) >> isEqTo = [1x2 logical] [] [] [] [1x2 logical] [1] [0] [0] find([isEqTo{:,2}]) >> ans = 1 so the problem here seems to be that []==x (x is any number) returns [] and not 0 do you have an improvement or a better solution to solve this problem? thx a lot
From: Oleg Komarov on 21 Jul 2010 05:55 > cellArray = {'aa' [] [] [] ; 'bb' [9600] [2] s2 }; > > so now i want to check, if there is a value ==9600 in column 2 > i tried > If you know in advance the number of the column and that column is numeric: % Find TF index tf = cellfun(@(x) isequal(x,9600), cellArray(:,2)); Oleg
From: Markus on 21 Jul 2010 07:39
"Oleg Komarov" <oleg.komarovRemove.this(a)hotmail.it> wrote in message <i26g5o$2io$1(a)fred.mathworks.com>... > > cellArray = {'aa' [] [] [] ; 'bb' [9600] [2] s2 }; > > > > so now i want to check, if there is a value ==9600 in column 2 > > i tried > > > > If you know in advance the number of the column and that column is numeric: > > % Find TF index > tf = cellfun(@(x) isequal(x,9600), cellArray(:,2)); > > Oleg perfect, thx a lot markus |