Hi Bernhard, you can do this, see the example below. There is one drawback with using the format statement though: you cannot reset the precise default, because this uses %g for doubles, not %#13.5g". Jurgen #include <oxstd.h> main() { // enter code decl x = rann(10,10); println("x[3:][3]=", x[3:][3]); // set the global format for matrix and double printing format("%4.2f"); decl f = fopen("test.mat", "w"); fprint(f, "%M", x); fclose(f); // reset the global format for matrix and double printing format("%#13.5g"); decl y = loadmat("test.mat"); println("y[3:][3]=", y[3:][3]); } oxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox oxoxoxox 4th OxMetrics user conference 2006 oxoxoxox Cass Business School, London oxoxoxox 14-15 September 2006 oxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox Dr Jurgen A Doornik Nuffield College, Oxford OX1 1NF, UK tel. UK: +44-1865-278610 fax +44-1865-278621 http://www.doornik.com http://www.oxmetrics.net oxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxoxox Bernhard Klingenberg wrote: > Hi all, > > it would be great if the savemat() function would also allow to save > numbers in a format such as "%4.2f" and not in the long scientific > notation. This can cut down significantly on the size of the saved file > (i.e., if it holds simulation output) and makes it easier for later > processing. Is it possible to program for such an option in savemat in a > later version? > > Cheers, > > Bernhard > > > Bernhard Klingenberg > Assist. Prof. of Statistics > Williams College > > Richard Lewney wrote: >> >> Dear Dimitris >> >> The number that you are seeking to handle in Ox, 3070109050, is too >> large to be held as an integer. The largest number that Ox will hold >> as an integer is 2147483647. Any larger number has to be held as a >> double. However, you can display a large integer in a format that >> looks like an integer, if that is what you want, instead of in the >> default (for a number of this size) scientific notation, by using a >> formatting command. >> >> The following short program shows >> (a) what happens as you approach, or exceed, the largest possible size >> of integer >> (b) how to display a large double so that it looks like an integer >> (which I think is what you want to do) >> >> Regards >> >> Richard Lewney >> Cambridge Econometrics >> >> >> main() >> { >> decl iX; >> >> // This number is held as an integer >> iX=2147483647; >> >> if (isint(iX)) >> println(iX," is an integer"); >> else if (isdouble(iX)) >> println(iX," is a double"); >> >> // This number is held as a double >> iX=2147483648; >> >> if (isint(iX)) >> println(iX," is an integer"); >> else if (isdouble(iX)) >> println(iX," is a double"); >> >> // This shows an unexpected thing that happens when you add 1 >> to the largest possible integer (it goes negative) >> iX=2147483647; >> iX=iX+1; >> >> if (isint(iX)) >> println(iX," is an integer"); >> else if (isdouble(iX)) >> println(iX," is a double"); >> >> // This shows different ways of displaying a large double >> iX=3070109050; >> >> println("Default format for printing iX: ", iX); >> >> println("Impose format for printing iX: ", "%12.0f",iX); >> >> >> >> >> >> *dimitris bagkavos <[log in to unmask]>* >> Sent by: The ox-users list is aimed at all Ox users >> <[log in to unmask]> >> >> 20/10/2006 16:41 >> Please respond to >> dimitris bagkavos <[log in to unmask]> >> >> >> >> To >> [log in to unmask] >> cc >> >> Subject >> large numbers as integers >> >> >> >> >> >> >> >> >> >> Dear Ox users, >> >> I would like, when loading say one really large number such as: 3070109050 >> through MS Excel to be able to assign that to a variable as integer >> and not as scientific notation (currently Ox assigns it as >> 3.07011e+009). >> I've tried to cast it to a string with: sprint("%d", int(CarryOvers)) >> (i'd be equally happy with that if it could work) but I had zero luck >> as it returns to me: -1224858246. >> >> Does anybody knows if there is any way around this ? >> >> Thanks in advance, >> Dimitris >> >> ======================================================================= >> Scanned for virus infection by Messagelabs >> ======================================================================= >> >> ======================================================================= >> This email has been scanned for Virus infection by MessageLabs >> For more information please contact [log in to unmask] >> =======================================================================