How do I read and plot ".trc" file?
古いコメントを表示
Hi every body,
I have a ".trc" file (C3--Trace--00001.trc) thi is the output of the BER tester, now I wont to read and plot this file in Matlab.
can you help me?
14 件のコメント
Rik
2020 年 11 月 23 日
It looks like there is a function that does this on the FEX. Did you try it? Did you get any errors?
Paolo Mirabelli
2020 年 11 月 24 日
Rik
2020 年 11 月 24 日
Functions posted on the FileExchange are written by cummunity members. You can either download the files from the website, or (only if you have R2017a or later) you can use the AddOn-manager. Otherwise Matlab can't find the function.
Paolo Mirabelli
2020 年 11 月 24 日
Rik
2020 年 11 月 24 日
I suspect TracesIdx is empty. The function is also written a bit strangly, by using size without specifying the dimension, while treating the output as a scalar.
Since it is a function from December 2014 and the author did not reply to a comment in November 2017, I doubt posting a comment will do much.
This function itself suggests a trc file is (mostly?) plain text. That means you can use normal text file reading tools to parse the file yourself.
Jan
2020 年 11 月 24 日
Please provide an input file, such that we can reproduce the problem. The best point to start from is contacting the author of the FEX submission, because he or she knows the code very well.
Paolo Mirabelli
2020 年 11 月 24 日
Rik
2020 年 11 月 24 日
You have a text file. Have you opened it with something like Notepad to look at the contents?
You haven't read the documentation for either the load function or the fileread function. I would suggest you read the documentation of any function you try to use, especially if you get an error.
If you want to read your file line by line, you can use my readfile function (which you can get from the FEX, or if you are using R2017a or later, you can also get it through the AddOn-manager). If you are using R2020b, you can also use the readlines function. Then you can write code that will extract the data from that line in your file.
I doubt you need to post all 500 million characters of the text file to show what is in your file and what you want to extract.
Paolo Mirabelli
2020 年 11 月 24 日
Rik
2020 年 11 月 24 日
I don't think I have seen something like this before. My only guess is that the file is too large for Notepad++ to properly load the file.
What you could do is attach the file you get if you do this:
chr=fileread('C3--Trace--00001.trc');
fid=fopen('C3--Trace--00001_part1.txt','w');
fprintf('%s',chr(1:10000));
fclose(fid);
That should be small enough to attach.
Paolo Mirabelli
2020 年 11 月 24 日
Rik
2020 年 11 月 24 日
Well that at least answers the question why the FEX submission I linked doesn't work: it is a completely different format.
Do you have any documentation about this file? What program should be used to read such a file?
Paolo Mirabelli
2020 年 11 月 24 日
Walter Roberson
2021 年 10 月 15 日
Your .trc file is LECROY_2_3 format. You should get ReadLeCroyBinaryWaveform by Jean-Daniel Deschênes from the File Exchange.
回答 (1 件)
Shubham Khatri
2020 年 12 月 7 日
0 投票
カテゴリ
ヘルプ センター および File Exchange で Data Import and Export についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
