Error: 'toascii' undefined near line

Hi everyone,

For the last couple of hours I have been searching the Net for any help to the following issue (maybe I am using the wrong keywords).
I have a .m script that was written in the Octave that came with Debian 10. Now, in a fresh install of Debian 11.3 with Octave 6.2.0 I can’t execute my script because it hangs after the following error:
error: ‘toascii’ undefined near line 13, column 13

If I try to use directly the function toascii (e.g. >> a= toascii(“ASCII”)), I get the exact same error. It is like some package is missing. But the general package is installed and loaded, and from this package, some functions work and others don’t.
On another computer, running Octave 7.1.0 on Windows 10, I get the exact same error!

Can anyone help me? What am I missing?
Thank you all for your time.
Best regards,
Emmanuel.

It has been replaced by double().

double("ASCII")
ans =

   65   83   67   73   73
2 Likes

Thank you a lot! You made my day. :slight_smile:
I was almost to the point of writing my own conversion script. :smiley:
Best regards,
Emmanuel.

Actually any other numeric cast would work as well:

octave:18> single("ASCII")
ans =

   65   83   67   73   73

octave:19> int16("ASCII")
ans =

  65  83  67  73  73

So toascii() became redundant.

1 Like

See also this table in the NEWS file for Octave 6:
octave: 7711b5e38ebc etc/NEWS.6.md (gnu.org)

Edit: Nicer formatting of that file here: GNU Octave Version 6

Removed functions and properties

The following functions and properties were deprecated in Octave 4.4
and have been removed from Octave 6.

  • Functions

    Function Replacement
    chop sprintf for visual results
    desktop isguirunning
    tmpnam tempname
    toascii double
    java2mat __java2mat__
1 Like

Interesting tables. I wasn’t aware of this publication. From now on, I’ll have a look a this kind of publication in case I get another similar error. Big lesson for me: Don’t ignore messages that warn about obsolete parts or advise about not being good for new designs. One never knows when one need to reuse old code in new systems. :slight_smile:
Thank you guys. You have been very helpful.
Best regards,
Emmanuel.