How to set the environment decimal separator in Octave?

558 Views Asked by At

It is anyway to set decimal separator in Octave different from OS default locale for decimals.

For example: normally I used point(.) for decimal separator like US locale, but sometimes I need to plot data that need to be presented with comma(,) as decimal separator like Europe locale.

How can it be done in Octave enviroment?

1

There are 1 best solutions below

1
Tasos Papastylianou On

I don't think octave supports locales like this. Maybe if you compile it from the very beginning against a particular locale, but I wouldn't advise that anyway.

Your best bet is to pre-process all relevant strings to replace dots with commas etc.

Alternatively you can rely on an external utility (e.g. the printf command in bash) to create a file of strings and then read them from your octave script.

Another thing to try is to try and replicate this https://undocumentedmatlab.com/articles/formatting-numbers/ in octave

(but, disclaimer, I tried, but run into this bug, which I reported just now: https://savannah.gnu.org/bugs/?60396)