필터 지우기
필터 지우기

separating columns in data files

조회 수: 1 (최근 30일)
Karla Galdamez
Karla Galdamez 2024년 2월 6일
댓글: Walter Roberson 2024년 2월 6일
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개)

Walter Roberson
Walter Roberson 2024년 2월 6일
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
Walter Roberson
Walter Roberson 2024년 2월 6일
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

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Data Import and Analysis에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by