Home > comms > read_spa.m

read_spa

PURPOSE ^

Get data

SYNOPSIS ^

function [f p] = read_spa(filename)

DESCRIPTION ^

Get data

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [f p] = read_spa(filename)
0002 %Get data
0003 fid = fopen(filename);
0004 if(fid<0)
0005   txt  = (sprintf('fid = fopen(''%s'');', filename));
0006 end
0007 
0008 s = textscan(fid, '%s', 'delimiter', 'EndOfLine');
0009 fclose(fid);
0010 a = s{1};
0011 
0012 %Find start of data
0013 end_data = length(a)-6;
0014 for i = 1:end_data
0015     if strcmp(a(i), '<APP_DATA>')
0016         start_data = i+1;
0017     end
0018 end
0019 
0020 j = 1;
0021 for i=start_data:end_data
0022     q = char(a(i));
0023     C = textscan(q, 'P_%d=%f , %f MHz');
0024     f(j) = C{3};
0025     p(j) = C{2};
0026     j = j+1;
0027 end
0028 
0029 plot(f,p);

Generated on Sun 14-Jun-2015 17:12:45 by m2html © 2005