get(0, 'format') change between 4.0 and 4.2 ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

get(0, 'format') change between 4.0 and 4.2 ?

CdeMills
Hello,

while testing the dataframe package under 4.2.1, I found that get(0, 'format') now generates an error as this property doesn't exist anymore; while it was available in 4.0.

The basic question is: how to get the format last set using the 'format' command in 4.2 ?

Regards

Pascal
Reply | Threaded
Open this post in threaded view
|

Re: get(0, 'format') change between 4.0 and 4.2 ?

Mike Miller-4
On Mon, Aug 14, 2017 at 08:57:55 -0700, CdeMills wrote:
> Hello,
>
> while testing the dataframe package under 4.2.1, I found that get(0,
> 'format') now generates an error as this property doesn't exist anymore;
> while it was available in 4.0.
>
> The basic question is: how to get the format last set using the 'format'
> command in 4.2 ?

Unfortunately this changed from 4.0 to 4.2, and will change again in
4.4.

In Octave 4.2, use

    fmt = __formatstring__ ();

This function is also available in Octave 4.0, by the way.

In Octave 4.4, this will become

    fmt = format ();

Similarly, if you need what used to be called 'FormatSpacing', in Octave
4.2 you would use __compactformat__, and in Octave 4.4 you would call
format with two output arguments.

--
mike

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: get(0, 'format') change between 4.0 and 4.2 ?

NJank
On Mon, Aug 14, 2017 at 12:17 PM, Mike Miller <[hidden email]> wrote:

> On Mon, Aug 14, 2017 at 08:57:55 -0700, CdeMills wrote:
>> Hello,
>>
>> while testing the dataframe package under 4.2.1, I found that get(0,
>> 'format') now generates an error as this property doesn't exist anymore;
>> while it was available in 4.0.
>>
>> The basic question is: how to get the format last set using the 'format'
>> command in 4.2 ?
>
> Unfortunately this changed from 4.0 to 4.2, and will change again in
> 4.4.
>


the get(0, 'Format') and get(0, 'FormatSpacing') issue came up a couple years ago [1].  It appears it is something Matlab intended to deprecate (listed back in the R2014 release notes), but it was still present and documented as the correct method to use in 2015 as they didn't have a replacement method. I just checked, and the current Matlab documentation still shows it as the correct method to use [2], and testing on 2017a the commands still work.

I think this is the case of Octave trying so hard to get ahead of the compatibility curve that we implemented a compatibility change before they did... What's changing again in 4.4?

Nick J.


[1] https://savannah.gnu.org/bugs/?46603
[2] https://www.mathworks.com/help/matlab/ref/format.html
Reply | Threaded
Open this post in threaded view
|

Re: get(0, 'format') change between 4.0 and 4.2 ?

John W. Eaton
Administrator
On 08/14/2017 03:04 PM, Nicholas Jankowski wrote:

> I think this is the case of Octave trying so hard to get ahead of the
> compatibility curve that we implemented a compatibility change before
> they did...

Ha.  Another one is isstr vs. ischar.  I believe isstr has been
deprecated in Matlab for years but still works without warning.

jwe