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

Réponses (1)

Walter Roberson
Walter Roberson le 6 Fév 2024

0 votes

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 commentaire

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

Connectez-vous pour commenter.

Catégories

En savoir plus sur MATLAB Coder dans Centre d'aide et File Exchange

Produits

Version

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by