Path: news.mathworks.com!not-for-mail
From: "us " <us@neurol.unizh.ch>
Newsgroups: comp.soft-sys.matlab
Subject: Re: How can delete a msgbox in a function
Date: Sat, 17 May 2008 14:43:01 +0000 (UTC)
Organization: Universit&#228;tsSpital Z&#252;rich
Lines: 23
Message-ID: <g0mqtl$47k$1@fred.mathworks.com>
References: <g0k4ll$mq7$1@fred.mathworks.com> <g0kg7i$206$1@canopus.cc.umanitoba.ca> <g0mjhd$m8p$1@fred.mathworks.com>
Reply-To: "us " <us@neurol.unizh.ch>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1211035381 4340 172.30.248.37 (17 May 2008 14:43:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 17 May 2008 14:43:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 11
Xref: news.mathworks.com comp.soft-sys.matlab:469006


"Frank Pezzulo":
<SNIP tired of his/her own messages...

> In total i call function 2 times. One
> time i want show msgbox, the second one i call same 
function but this time i don't want msgbox....

one of the many solutions is outlined below
- copy/paste the snippet into a file <foo.m>
- at the command prompt, repeatedly type foo, eg,
     foo % <- shows msg
     foo % <- does not show msg
     foo % <- shows msg

function foo
if   ~isempty(getappdata(0,'hasbox'))
     setappdata(0,'hasbox',[]);
else
     msgbox('text','string');
     setappdata(0,'hasbox',true);
end

us