Prev: System Identification: how to specificy a 0 delay ARX model in rarx?
Next: "matlabpool close" vs "matlabpool close force" ?
From: loli J on 31 May 2010 11:01 Hi all,, In matlab GUI , How can I say that if the user click a button "B" and the axes "X" is empty ( I mean there is no image displayed on the axes) , an error message is displayed ? Thanks all =)
From: Matt Fig on 31 May 2010 11:36 if ~any(cellfun(@(x) strcmp(x,'image'),get(findobj(gca),'type'))) error(...) end
From: Walter Roberson on 31 May 2010 11:48 Matt Fig wrote: > if ~any(cellfun(@(x) strcmp(x,'image'),get(findobj(gca),'type'))) > error(...) > end Shorter: if isempty(findall(gca, 'type', 'image')) error(...) end
From: loli J on 31 May 2010 12:07 "Matt Fig" <spamanon(a)yahoo.com> wrote in message <hu0l14$2o4$1(a)fred.mathworks.com>... > > > > if ~any(cellfun(@(x) strcmp(x,'image'),get(findobj(gca),'type'))) > error(...) > end Thanks for ur reply I got an error :'( ??? Error using ==> cellfun Input #2 expected to be a cell array, was char instead. Error in ==> second>pushbutton2_Callback at 197 if ~any(cellfun(@(axes1) strcmp(axes1,'image'),get(findobj(gca),'type'))) How can I deal with it
From: loli J on 31 May 2010 12:16
Walter Roberson <roberson(a)hushmail.com> wrote in message <2TQMn.87684$0B5.8177(a)newsfe05.iad>... > Matt Fig wrote: > > > if ~any(cellfun(@(x) strcmp(x,'image'),get(findobj(gca),'type'))) > > error(...) > > end > > Shorter: > > if isempty(findall(gca, 'type', 'image')) > error(...) > end Thanks it works =) Thank u all |