From: smith Og on
Hi,

How do I suppress the error display in the command window. I know for warning display, I can use 'warning off all', .

I intend to use the errordlg only, so I do not want the error to be displayed in the command window.

Thanks.
From: Andy on
"smith Og" <adeog(a)ymail.com> wrote in message <i36o1b$4tq$1(a)fred.mathworks.com>...
> Hi,
>
> How do I suppress the error display in the command window. I know for warning display, I can use 'warning off all', .
>
> I intend to use the errordlg only, so I do not want the error to be displayed in the command window.
>
> Thanks.

doc try
From: Walter Roberson on
smith Og wrote:

> How do I suppress the error display in the command window. I know for
> warning display, I can use 'warning off all', .
>
> I intend to use the errordlg only, so I do not want the error to be
> displayed in the command window.

I do not know of any way to suppress the display of an error() message.

However, you can use try/catch to catch the error. A caught error will
not print out anything.
From: smith Og on
Walter Roberson <roberson(a)hushmail.com> wrote in message <bHB5o.33927$o27.23653(a)newsfe08.iad>...
> smith Og wrote:
>
> > How do I suppress the error display in the command window. I know for
> > warning display, I can use 'warning off all', .
> >
> > I intend to use the errordlg only, so I do not want the error to be
> > displayed in the command window.
>
> I do not know of any way to suppress the display of an error() message.
>
> However, you can use try/catch to catch the error. A caught error will
> not print out anything.

Thank you Andy, Walter.

try /catch works.

However, to go a step further, when I use the try and catch , is there a way to invoke the try again.

For example,

try
statements
statements

catch
errordlg('error in your input')
end

Is there a way I can return the command back to the begining of the try statement, so that if the user now puts a valid input , then no error is generated.

I do not want to use the if statement, I just want the command to go back to the begining of the try statement, once an error is generated.

Thank you.
From: Andy on
"smith Og" <adeog(a)ymail.com> wrote in message <i36riu$81$1(a)fred.mathworks.com>...
> Walter Roberson <roberson(a)hushmail.com> wrote in message <bHB5o.33927$o27.23653(a)newsfe08.iad>...
> > smith Og wrote:
> >
> > > How do I suppress the error display in the command window. I know for
> > > warning display, I can use 'warning off all', .
> > >
> > > I intend to use the errordlg only, so I do not want the error to be
> > > displayed in the command window.
> >
> > I do not know of any way to suppress the display of an error() message.
> >
> > However, you can use try/catch to catch the error. A caught error will
> > not print out anything.
>
> Thank you Andy, Walter.
>
> try /catch works.
>
> However, to go a step further, when I use the try and catch , is there a way to invoke the try again.
>
> For example,
>
> try
> statements
> statements
>
> catch
> errordlg('error in your input')
> end
>
> Is there a way I can return the command back to the begining of the try statement, so that if the user now puts a valid input , then no error is generated.
>
> I do not want to use the if statement, I just want the command to go back to the begining of the try statement, once an error is generated.
>
> Thank you.

% something like this:

validInput = false;
userInput = input('Get user input here: ');

while ~validInput
try
process(userInput); % do whatever to the input
validInput = true;
catch
disp('Error in your input')
validInput = false;
end
end