separating columns in data files

Hello!
I have a data file, attached. I would like to only obtain the positive values of this file, i.e. only the first column and then make a subsequent text file.
This file is the output of fft on a data file, thus it contains both real values and imaginary values.
Thank you!
Karla

回答(1 个)

You only have one column of data -- those are complex numbers.
"Only positive" would restrict to just the very first point. Every other point is complex-valued with non-zero imaginary part, and so could not be said to be positive.

1 个评论

Y = readmatrix('Y.txt');
Ypositive = Y(real(Y)>0);
writematrix(Ypositive, 'Ypositive.txt');
dbtype Ypositive.txt 1:10
1 3464.328258+0i 2 0.000674780887635507-0.0611685605125578i 3 0.00285671163585732-0.0454525189854182i 4 0.00421265752004274-0.0361586728286951i 5 0.00516887965437718-0.0294093650495321i 6 0.00573141263822663-0.025892194218674i 7 0.00562182728276639-0.022676055193402i 8 0.00575974729039785-0.0200011190135066i 9 0.00579318668150108-0.0180308127612939i 10 0.0056623294612308-0.0162200839423056i

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Standard File Formats 的更多信息

产品

版本

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by