- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I tried to read multiple data from one line in my datafile.
Data format is :
0.3,0.9,1.2,2.3
Comma is used to separate each of them, but I don't know how many in one line. I want to use an array to read all of them, like,
read(10,'(f5.2)')value(1),value(2),...
How to make it happen to my array value?
Thanks!
Roy
I tried to read multiple data from one line in my datafile.
Data format is :
0.3,0.9,1.2,2.3
Comma is used to separate each of them, but I don't know how many in one line. I want to use an array to read all of them, like,
read(10,'(f5.2)')value(1),value(2),...
How to make it happen to my array value?
Thanks!
Roy
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Pasted from CVF help found using 'comma' in the 'Index':
Code:
Using Commas to Separate Input Data You can use a comma to terminate a short data field.
The comma has no effect on the d part (the number of
characters to the right of the decimal point) of the specification. The comma overrides the w specified for the I, B, O, Z, F, E, D,
EN, ES, G, and L edit descriptors. For example, suppose the
following statements are executed: READ (5,100) I,J,A,B 100 FORMAT (2I6,2F10.2) Suppose a record containing the following values is read: 1, -2, 1.0, 35 The following assignments occur: I = 1 J = -2 A = 1.0 B = 0.35 A comma can only terminate fields less than w characters long.
If a comma follows a field of w or more characters, the comma
is considered part of the next field. A null (zero-length) field is designated by two successive
commas, or by a comma after a field of w characters. Depending
on the field descriptor specified, the resulting value assigned
is 0, 0.0, 0.0D0, 0.0Q0, or .FALSE..

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page