From: Mike on 2 Apr 2010 04:03 Hi a={[]}; >> isempty(a) ans = 0 >> isempty(a{1}) ans = 1 Does this mean isempty not working for cell but string? Is there one which can determine wheter or not the contents of cell are empty? Mike
From: Bruno Luong on 2 Apr 2010 04:34 Mike <sulfateion(a)gmail.com> wrote in message <e43a96e4-6c06-4bde-be01-cd5c0040a84b(a)l36g2000yqb.googlegroups.com>... > Hi > > a={[]}; > >> isempty(a) > > ans = > > 0 Yes Matlab returns the correct answer, the above cell contains something (an empty set) but regardless, hence it's NOT empty. Here is an empty cell a = {} % It contains nothing.
From: Matt Fig on 2 Apr 2010 09:21 a = {[], rand, magic(3),[]} cellfun('isempty',a)
From: us on 2 Apr 2010 12:04 Mike <sulfateion(a)gmail.com> wrote in message <e43a96e4-6c06-4bde-be01-cd5c0040a84b(a)l36g2000yqb.googlegroups.com>... > a={[]}; > >> isempty(a) > ans = > 0 > >> isempty(a{1}) > ans = > 1 > Does this mean isempty not working for cell but string? as usual, ML is quite correct... consider this - A is a drawer the CELL == {} which contains an shoebox that - in this case - happens to be empty... the DOUBLE == [] - now, the drawer is NOT empty as it contains something - even if the ...something... is empty... isempty(a) whereas the shoebox IS empty isempty(a{1}) us
From: Mike on 13 Apr 2010 20:37
On Apr 3, 12:04 am, "us " <u...(a)neurol.unizh.ch> wrote: > Mike <sulfate...(a)gmail.com> wrote in message <e43a96e4-6c06-4bde-be01-cd5c0040a...(a)l36g2000yqb.googlegroups.com>... > > a={[]}; > > >> isempty(a) > > ans = > > 0 > > >> isempty(a{1}) > > ans = > > 1 > > Does this mean isempty not working for cell but string? > > as usual, ML is quite correct... > consider this > - A is a drawer > the CELL == {} > which contains an shoebox that - in this case - happens to be empty.... > the DOUBLE == [] > - now, > the drawer is NOT empty as it contains something - even if the ...something... > is empty... > isempty(a) > whereas the shoebox IS empty > isempty(a{1}) > > us Very interesting and clear explanation. Thank you. Mike |