Fortran [fortran90] arrange value in row into column

AI Thread Summary
To rearrange data from a row format to a column format in Fortran90 or MATLAB, it's important to understand that Fortran treats 1D arrays uniformly, without a distinction between row and column vectors. The data in a file, whether binary or text, is simply a sequence of numbers or characters, not inherently organized in rows or columns. In MATLAB, you can reshape the data using the reshape function, while in Fortran, you would typically read the data into a 1D array and then access or output the elements in a column-wise manner. Understanding these distinctions is crucial for effective data manipulation in both programming environments.
s_hy
Messages
57
Reaction score
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
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.
 
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.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...
Back
Top