How to load a .dat file? I saved the Oscilloscope(waverunner 610zi) Please refer to the attached file and let me know.

3 件のコメント

Ameer Hamza
Ameer Hamza 2018 年 5 月 6 日
The files you attached are empty. They don't contain any Oscilloscope readings.
milksba
milksba 2018 年 5 月 6 日
Can you check it again?
Ameer Hamza
Ameer Hamza 2018 年 5 月 6 日
Yes, the file now contains the data. Please check my answer below.

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

 採用された回答

Ameer Hamza
Ameer Hamza 2018 年 5 月 6 日
編集済み: Ameer Hamza 2018 年 5 月 6 日

1 投票

You can import the file easily by import tool
uiimport
but if you want to import it programatically, do it like this
f = fopen('M1--L10-22 TR SW--00000.dat');
data = textscan(f, '%f %f');
data = cell2mat(data); % convert to matrix from cell array
fclose(f)

5 件のコメント

Stephen23
Stephen23 2018 年 5 月 6 日
Never fopen a file without also fclose-ing it!
Opening lots of files without closing is a common cause of questions on this forum. Beginners do this and get very confused when MATLAB unexpectedly fails after too many files were opened.
It is also recommended to check the fopen status, e.g.:
fnm = 'M1--L10-22 TR SW--00000.dat'
[fid,msg] = fopen(fnm,'rt');
assert(fid>=3,msg)
...
fclose(fid);
Ameer Hamza
Ameer Hamza 2018 年 5 月 6 日
@Stephen thanks for pointing out. This can create problems if one is not careful.
milksba
milksba 2018 年 5 月 6 日
I can't do both. Can you check it again?
Ameer Hamza
Ameer Hamza 2018 年 5 月 6 日
What is the error?
milksba
milksba 2018 年 5 月 6 日
編集済み: milksba 2018 年 5 月 6 日
Complete verification.
I have another question. Can you solve it?
I want to draw the corresponding file, Waveform, FFT file.
But I think my coding has a problem. Can you look at it?
I want to set the frequency in MHz
The code is in the zip file.

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLarge Files and Big Data についてさらに検索

質問済み:

2018 年 5 月 6 日

編集済み:

2018 年 5 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by