saving data from text file which meets conditions

1 回表示 (過去 30 日間)
Chris Murchison
Chris Murchison 2021 年 3 月 19 日
編集済み: Jan 2021 年 3 月 23 日
Hi, I am trying to save rows of data which meet the criteria that I am setting.
I have a large text file and trying to save the rows which meet conditons to preproces my data.
I am getting the error:
Error using norm
First argument must be single or double.
Error in remove_first_row (line 4)
if norm(xyData(i,2:4))>1E-3
Can anyone help?
xyData = ('ANNDB1.txt');
T = [];
for i = 1:length(xyData)
if norm(xyData(i,2:4))>1E-3
if norm(xyData(i,8:10))>1E-3
if norm(xyData(i,14:16))-norm(1,1,0)>1
T = [T; xyData(i,:)]
end
end
end
end
P = table(T(:,1), T(:,2:4), T(:,5:7), T(:,8:10), T(:,11:13), T(:,14:16), T(:,17:19), 'VariableNames', {'t', 'U1', 'U2', 'V1', 'V2', 'R1', 'R2'});
writetable(T,'PrePANNDB1.txt')
  2 件のコメント
Mathieu NOE
Mathieu NOE 2021 年 3 月 19 日
hello
so what is the class and dimension of xyData ?
Mathieu NOE
Mathieu NOE 2021 年 3 月 23 日
hello
problem solved ?

サインインしてコメントする。

回答 (1 件)

Jan
Jan 2021 年 3 月 23 日
編集済み: Jan 2021 年 3 月 23 日
xyData = ('ANNDB1.txt');
Now xyData is the char vectpr 'ANNDB1.txt' . I guess, this is a file name. Then you have to import the contents of the file at first. Processing the name of the file is not useful. Maybe:
xyData = readtable('ANNDB1.txt');

カテゴリ

Help Center および File ExchangeStructures についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by