help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

File being written backwards???


From: martine1212
Subject: File being written backwards???
Date: Tue, 16 Jul 2013 12:07:48 -0700 (PDT)

I just copied my matlab code..... trying to generate a S2P file.

#Generate S2P file
S2P_name=strcat(filename, '.s2p');
#Open the file
data_file=fopen(S2P_name, 'a+');
#Write the data format line//
test_string=sprintf('#Hz  S RI R 50 \r\n');
fprintf(data_file, '%s',test_string);
#Write the actual data header//
test_string=sprintf('! S-Parameters data
\r\n!Freq\treS11\timS11\treS21\timS21\treS1\timS12\treS22\timS22\r\n');
fprintf(data_file, '%s',test_string);

S_par_array=[Frequency real(S11M) imag(S11M) real(S21M) imag(S21M)
real(S12M) imag(S12M) real(S22M) imag(S22M)];
dlmwrite(S2P_name,S_par_array,'-append','delimiter',
'\t','roffset',1,'coffset',0);
fclose(data_file);  

I would expect the data format line and data header be at the top of the
file.... and all the S parameter data be after those two lines...
nonetheless the actual file looks like:

49750250000     0.1569443       -0.0564423      0.1366272       -0.2800446      
0.9827271       0.0524902
-0.00751972     -0.029356
49812687500     0.037178        0.1526413       0.1425629       -0.2802277      
0.9831238       0.0175171
0.132988        0.025116
49875125000     -0.04058266     -0.06029701     0.1422577       -0.2688751      
0.9958496       0.0491638
-0.03380966     -0.04774857
49937562500     0.1722794       0.0332947       0.1567383       -0.2647247      
0.954071        0.025238
0.1105537       0.06418227999999999
50000000000     -0.0390625      0.1570053       0.147995        -0.2713776      
0.9662781       0.0366516
0.016716        -0.09030533
#Hz  S RI R 50 
! S-Parameters data 
!Freq   reS11   imS11   reS21   imS21   reS1    imS12   reS22   imS22

The data is on top and the first lines that were written are at the very
bottom of the file.

The top of the file shows a bunch of "tabs"??

\t\t\t\t\t\t\t\t
50000000        0.006952763     0.01445627      0.3108673       -0.0027313      
0.9924011       -0.0162048
0.00176239      -0.03898048
112437500       -0.02940273     -0.00743484     0.3188477       -0.0049744      
0.9979553       -0.0068054
-0.02038765     0.01197338


isn't the file be to be written the other way around???





                   



--
View this message in context: 
http://octave.1599824.n4.nabble.com/File-being-written-backwards-tp4655719.html
Sent from the Octave - General mailing list archive at Nabble.com.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]