extracting coordinates numbers from array of coordinates

2 views (last 30 days)
Hello ,I Have a text file which i mannaged to sliceout one subtable from it.(attched txt file)
and convert the frequency string to a number array.
next i ned to convert the string array of data into number array but its more difficult.
each cell is of form '(-7.30313259052058e-002dB,-4.26354774426478e+000°)'
in the end of this script i am trying to use text scan however it gives me two empty cell with square symbols in them.
i would like to get the D array into other array 2X1000 with the numbers in them.
Thanks
fid=fopen('testnew1.txt');
g= textscan(fid,'%s','delimiter','\n');
leng=length(g{1});
fclose(fid);
k=1;
for j=3:1:1002
f_str(k)=g{1}(j,1);
C= strsplit(char(g{1}(j,1)),'\t');
F(k) = strsplit(char(C{1}),' ');
D(k)=strsplit(char(C{2}),' ');
frec_subtable(k) = str2num(F{k});
%m(k) = textscan(D(k),'%d');
%cords4= textscan(t, '(%fdB%f)');
h = textscan(D(k), '(%4fdB%f°)', 'Delimiter',',')
k=k+1;
end

Answers (1)

Walter Roberson
Walter Roberson on 21 Jun 2019
textscan does not permit cell array inputs as the first parameter.

Community Treasure Hunt

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

Start Hunting!