From: Nathan on 17 Feb 2010 20:43 On Feb 17, 5:25 pm, "Sinisa Jelicic" <tis...(a)gmail.com> wrote: > > You can do it via cellfun, if you want. > > cellfun(@(x)x{400},In{1}(2:3),'un',0) > > > Note, the outcome will be a cell array as well. > > > -Nathan > > wow > what @(x)x{400} represents > what 'un',0 represents > > I have problem like this > cell arrays > > <1x10><4500x1> > > and I need let's say 40th element from <4500x1> from first 3 columns of <1x10> > > Thanks > Sinisa First off, did that work for you? @(x)x{400} represents an anonymous function. The parameter is defined by x. I passed In{1}(2:3) to x. The cellfun then goes through both cells In{1}(2) and In{1}(3) and grabs the {400} cell from each and returns them. 'un' is short for UniformOutput. see the cellfun documentation for more details. 0 stands for false, as in I am asking for not UniformOutput and to place output in individual cells Do you understand that you keep asking the same question over and over again? Manipulate what I gave you to retrieve the "40th element from <4500x1> from first 3 columns of <1x10>" Assume cellarray is your <1x10><4500x1> elementtoget = 40; cellfun(@(x)x{elementtoget},cellarray(1:3)) -Nathan
From: Sinisa Jelicic on 17 Feb 2010 21:34 > First off, did that work for you? > > @(x)x{400} represents an anonymous function. > The parameter is defined by x. I passed In{1}(2:3) to x. > The cellfun then goes through both cells In{1}(2) and In{1}(3) and > grabs the {400} cell from each and returns them. > > 'un' is short for UniformOutput. see the cellfun documentation for > more details. > 0 stands for false, as in I am asking for not UniformOutput and to > place output in individual cells > > Do you understand that you keep asking the same question over and over > again? > > Manipulate what I gave you to retrieve the "40th element from <4500x1> > from first 3 columns of <1x10>" > > Assume cellarray is your <1x10><4500x1> > elementtoget = 40; > cellfun(@(x)x{elementtoget},cellarray(1:3)) > > > > -Nathan Thanks, now I understand the principle but it does not work I get this error >> cellfun(@(x)x{40},tmp3(1:3)) ??? Cell contents reference from a non-cell array object. Error in ==> @(x)x{40} Thank you Sinisa
First
|
Prev
|
Pages: 1 2 3 Prev: help-- fit complex data Next: How do I execute *.m file and *.mdl file simultaneously |