[fortran90] arrange value in row into column

In summary, the conversation discusses rearranging data from a row into a column in a specific format using Fortran90 or MATLAB. The expert explains that in Fortran, there is no distinction between a row vector and a column vector, and a 1D array is simply a 1D array. They also mention that data in a file is not inherently arranged in rows or columns, as it can contain non-printing characters.
  • #1
s_hy
61
0
I have a data file, let's say test.dat which is contain [1 2 3 4 5 6 7...3000]. the question is how can I re-arrange this data from a row into a column so that I will have a set of data like this
1
2
3
4
5
6
7
.
.
.
3000

in fortran90 or MATLAB also will be okay.

thank you
 
Technology news on Phys.org
  • #2
I don't understand what you are trying to do. In Fortran, there is no distinction between a row vector and a column vector. A 1D array is just a 1D array.
 
  • #3
Also, the data in a file is not arranged in rows or columns. It's a sequence of numbers (binary file) or characters (text file). There can also be non-printing characters such as tab, newline, and other control characters.
 

1. How do I arrange values in a row into a column in Fortran90?

To arrange values in a row into a column in Fortran90, you can use the TRANSPOSE function. This function takes in an array and returns a transposed array, where the rows become columns and columns become rows.

2. Can I arrange values in a specific order when transposing rows into columns in Fortran90?

Yes, you can specify the order in which the values are arranged when using the TRANSPOSE function. This can be done by using the ORDER argument and specifying the desired order (row-major or column-major) in the function call.

3. How do I assign the transposed values to a new array in Fortran90?

You can use the ASSIGN statement to assign the transposed values to a new array in Fortran90. This statement takes in the original array, the transposed array, and the ORDER argument to determine the order of the values in the transposed array.

4. Is it possible to arrange values in a row into multiple columns in Fortran90?

Yes, it is possible to arrange values in a row into multiple columns in Fortran90. This can be done by specifying the desired number of columns in the TRANSPOSE function call. The function will then arrange the values accordingly in the transposed array.

5. Are there any other ways to arrange values in a row into a column in Fortran90?

Yes, there are other ways to arrange values in a row into a column in Fortran90. One alternative is to use the RESHAPE function, which allows you to reshape an array into a different shape. This can be useful when you want to rearrange the values in a non-standard way.

Similar threads

  • Programming and Computer Science
Replies
16
Views
2K
  • Programming and Computer Science
Replies
12
Views
1K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
7
Views
443
  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
1
Views
914
  • Programming and Computer Science
Replies
7
Views
1K
  • Programming and Computer Science
Replies
3
Views
825
  • Programming and Computer Science
Replies
4
Views
918
  • Programming and Computer Science
Replies
11
Views
2K
Back
Top