Info

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

Need some help with writing date from txt and formating them in same format to another txt file.

조회 수: 2 (최근 30일)
I have been experiencing some troubles in reading the values that are on the file and formating appropriately then writing them on the another txt file.tThat is what i am trying to do . there is a panel1.txt which has the coordinates of airfoil side by side. QF will be my variable it should store the coordinates in 19 by 2 matrix(since 19 columns of input stored in panel1) as it is already inputting on the panel1 txt file. When i run this script in seperate it gives "Assignment has more non-singleton rhs dimensions than non-singleton subscripts" type error sometimes different i am not much familiar with matlab so dont understand the problem and when it reads the files i want to write them as the same format to another file in this case panel2.txt . I am not even sure about the type of the QF variable which should be 3 dimensional matrix but matlab not seem to like it i am actually converting some codes from fortran which is my main coding language. Can someone help me about this conversion any help is appreciated. I attached the panel1.txt. If anybody knows fortran i can send the code i try to convert.
fileID1 = fopen('panel1.txt','r');
fileID2 = fopen('panel2.txt','r');
fprintf(fileID2,' AIRFOIL COORDINATES \n =================== \n X Z')
IB1=fscanf(fileID1,'%3d');
for I=1: IB1
QF(I,1,1)=fscanf(fileID1,'%f %f');
QF(I,1,3)=fscanf(fileID1,'%f %f');
fprintf(fileID2,'%f %f',QF(I,1,1),QF(I,1,3));
end %10
fclose(fileID11);
fclose(fileID12);
  댓글 수: 2
Azzi Abdelmalek
Azzi Abdelmalek 2016년 8월 20일
You can make your question brief and clear. Tell how your data are stored in your text file, you can post a short example.
Ege Konuk
Ege Konuk 2016년 8월 20일
I shared the txt file in it you can check out it acutally reads the file but it stores in in the only in one column i want it to be 2 column the input is like this ;
1.000 0.000
0.905 -0.012
0.794 -0.026
0.655 -0.046
and i also want to skip first row there is naca number written in first row. i should start 2nd row and to the end 19th row i guess

답변 (0개)

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

Community Treasure Hunt

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

Start Hunting!

Translated by