필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

How to load a file into the matrix form in linux platform?

조회 수: 1 (최근 30일)
Homayoon
Homayoon 2015년 9월 16일
마감: Walter Roberson 2015년 9월 17일
Hello All,
I have recently switched to the linux platform and I have some questions.
First, I suppose I do not need anything in my windows script file (m-file) while I am compiling it in linux. Right?
Second which is extremely important to me and can save me thousands of hours:
I have a gigantic file in the following format:
ITEM: TIMESTEP
0
ITEM: NUMBER OF ATOMS
200
ITEM: BOX BOUNDS pp pp pp
0 23.5
0 23.5
0 23.5
ITEM: ATOMS id type x y z
1 1 4.629738099 19.15100895 8.591289203
2 1 5.379313371 19.12269554 8.727806695
3 1 7.531762324 13.25286645 4.981542453
4 1 7.427444873 13.99400029 5.110889318
5 1 21.55774217 15.43904552 5.981577486
6 1 21.46897866 15.51226749 5.231419927
7 1 14.99102971 3.73871179 18.17533436
8 1 14.2887607 3.667327185 18.45545109
the file is consisting of 6000000 cycles.each cycle contains 209 lines. the first 9 lines of each cycle are exactly similar and including words, the other 200 lines are containing numbers in the matrix format you can see in the example illustrated above. The only information which i need to have is the last 4 columns of the matrix form for each cycle.
Previously, I used a fortran code to convert the original gigantic file to the following format:
1 4.62973809900 19.15100895000 8.59128920300
1 5.37931337100 19.12269554000 8.72780669500
1 7.53176232400 13.25286645000 4.98154245300
1 7.42744487300 13.99400029000 5.11088931800
1 21.55774217000 15.43904552000 5.98157748600
1 21.46897866000 15.51226749000 5.23141992700
And then by transferring this file to my desktop where I could easily use load syntax to save the contents in a matrix form. Then I could do my calculations.
Please note that, my transferred file has 600000*200 lines and each of these lines has 4 columns. In other words I connected the cycles to eachother and removing the first 9 lines of each cycle. Is it possible to do the same thing in MATLAB? as a result, I will no longer need to first use my fortran code and then transfer the file to my desktop and load the file.
My read format in fortran is :
format(21x,f16.0,10x,f16.0,10x,f16.0)
and my write format was :
format(A1,1x,f16.11,5x,f16.11,5x,f16.11)
I do appreciate if anyone can help me with these questions. Thanks

답변 (0개)

이 질문은 마감되었습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by