octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: lastwarn vs. lasterr


From: Carnë Draug
Subject: Re: lastwarn vs. lasterr
Date: Tue, 28 Apr 2015 17:57:39 +0100

On 28 April 2015 at 17:05, rik <address@hidden> wrote:
> All,
>
> I started to pull on a small bug in fail.m and dislodged something more
> major.  The message that is stored by calling warning () includes the
> prefix "warning: " while the message stored by calling error () does not
> include the prefix "error :".
>
> --- Sample Code ---
> octave:58> warning ("foobar")
> warning: foobar
> octave:59> lastwarn
> ans = warning: foobar
>
> octave:60> error ("foobar")
> error: foobar
> octave:60> lasterr
> ans = foobar
> --- End Code ---
>
> Is there any reason why these should be different?  What does Matlab do?
>
> My preference would be to change it so that warning does not include the
> prefix.  This is a relatively easy change in error.cc.
>

Seems like Matlab drops the prefix in both cases, so you can have it
your way ;)

-- Matlab R2010b
>>  warning ('foobar')
Warning: foobar
>> lastwarn

ans =

foobar

>> error ('foobar')
??? foobar

>> lasterr

ans =

foobar



reply via email to

[Prev in Thread] Current Thread [Next in Thread]