Filter löschen
Filter löschen

separating columns in data files

1 Ansicht (letzte 30 Tage)
Karla Galdamez
Karla Galdamez am 6 Feb. 2024
Kommentiert: Walter Roberson am 6 Feb. 2024
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

Antworten (1)

Walter Roberson
Walter Roberson am 6 Feb. 2024
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 Kommentar
Walter Roberson
Walter Roberson am 6 Feb. 2024
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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Data Import and Analysis finden Sie in Help Center und File Exchange

Produkte


Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by