extracting coordinates numbers from array of coordinates

조회 수: 2 (최근 30일)
fima v
fima v 2019년 6월 21일
댓글: fima v 2019년 6월 21일
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

답변 (1개)

Walter Roberson
Walter Roberson 2019년 6월 21일
textscan does not permit cell array inputs as the first parameter.

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by