You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, I've been away from the project for a long time, and could not find discussions over some features of savetxt that I find useful, following mostly numpy savetxt behavior. I'd like to change the interface to something like. Please let me know
if there is any interest. As I said I could not find if it already was discussed and discarded.
array: Shall be a rank-2 array of type real, complex or integer.
filename or unit: Shall be either a character expression containing the name of the file or an integer containing the unit of an already open file, that will contain the 2D array. Setting the two of them shall give an error
delimiter (optional): Shall be a character expression of any length that contains the delimiter used to separate the columns. The default is a single space ' '.
fmt: (optional): Fortran format specifier for the text save. Defaults to the write format for the data type.
header: (optional) Shall be a character expression that will be written at the beginning of the file.
footer: (optional) Shall be a character expression that will be written at the end of the file.
comments: (optional) : Shall be a character expression of(length 1 that will be prepended to the header and footer strings to mark them as comments. Default: # .
Output
Provides a text file called filename that contains the rank-2 array.
Adding the possibility of providing a unit number in place of a filename gives flexibility to add partial tables to a file.
fmt Gives the possibility of customize the output. In many cases complex calculations give only a few significant figures and I would like the number saved to express that.
header and footer give the possibility to add information to the data files (column names, information on parameters used in calculations or measurements, etc).
Following numpy I find extremely useful if non-data information is commented or signaled in some form. This would be the use of the argument comment.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello, I've been away from the project for a long time, and could not find discussions over some features of savetxt that I find useful, following mostly numpy savetxt behavior. I'd like to change the interface to something like. Please let me know
if there is any interest. As I said I could not find if it already was discussed and discarded.
savetxt- save a 2D array into a text fileStatus
Experimental
Description
Saves a rank-2
arrayinto a text file.Syntax
call[[stdlib_io(module):savetxt(interface)]](array [, filename | unit] [, delimiter] [, fmt] [, comments] [, header])Arguments
array: Shall be a rank-2 array of typereal,complexorinteger.filename or unit: Shall be either a character expression containing the name of the file or an integer containing the unit of an already open file, that will contain the 2Darray. Setting the two of them shall give an errordelimiter(optional): Shall be a character expression of any length that contains the delimiter used to separate the columns. The default is a single space' '.fmt: (optional): Fortran format specifier for the text save. Defaults to the write format for the data type.header: (optional) Shall be a character expression that will be written at the beginning of the file.footer: (optional) Shall be a character expression that will be written at the end of the file.comments: (optional) : Shall be a character expression of(length 1 that will be prepended to theheaderandfooterstrings to mark them as comments. Default:#.Output
Provides a text file called
filenamethat contains the rank-2array.Rationale
Antecedents
Python's Numpy
I have a similar function
Discussion
unitnumber in place of afilenamegives flexibility to add partial tables to a file.fmtGives the possibility of customize the output. In many cases complex calculations give only a few significant figures and I would like the number saved to express that.headerandfootergive the possibility to add information to the data files (column names, information on parameters used in calculations or measurements, etc).comment.Beta Was this translation helpful? Give feedback.
All reactions