[Top][All Lists]

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


From: John W. Eaton
Subject: toascii/abs
Date: Tue, 23 Mar 1999 17:40:22 -0600 (CST)

On 23-Mar-1999, Daniel Heiserer <address@hidden> wrote:

| Hi,
| I have a problem with abs(a), if a is a string under octave.
| In matlab that returns the ascii-values of the elements of a.
| In octave I have a feature 'toascii'.
| Unfortunately I cannot edit the 'abs' function because it is a builtin.
| It would be nice if 'abs(a') would return what 'toascii(a)' returns
| if 'a' is a string/stringmatrix.

Perhaps this is what you are looking for?

  octave:1> implicit_str_to_num_ok = 1
  implicit_str_to_num_ok = 1
  octave:2> abs ("foobar")
  ans =

    102  111  111   98   97  114

It seems to me that abs() (i.e., absolute value) is a function that
would apply to numbers, not strings.  Why not write your code to use
toascii and then provide a simple wrapper function if you have to run
your code in an environment that doesn't provide a suitable toascii


reply via email to

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