[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: File being written backwards???
From: |
c. |
Subject: |
Re: File being written backwards??? |
Date: |
Tue, 16 Jul 2013 21:19:15 +0200 |
On 16 Jul 2013, at 21:07, martine1212 <address@hidden> wrote:
> 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 think you should do 'fclose' before 'dlmwrite' ...
HTH,
c.