이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
How do I read and plot ".trc" file?
조회 수: 190 (최근 30일)
이전 댓글 표시
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일
I do not understand you. what is FEX?
I have tried the solution posted in this topic " How do I view .trc files?" but it doesn't work. I have an error with function
readtrace('C3--Trace--00001.trc'); Unrecognized function or variable 'readtrace'.
at this point i don't know ho to proceed.
can you help me?
can you suggest me some library for loading a trc file and the plot?
thank you very much
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일
thank you very much, I have installed readtrc from FileExchange but now i have this error:
>> readtrc('C3--Trace--00001.trc');
Array indices must be positive integers or logical values.
Error in readtrc (line 20)
traces{k+1,1}=cell2mat(Columns(TracesIdx(size(TracesIdx))+4:size(Rows{1,1})));
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일
I tried to attach but it is larger than 5MB(also .zip).
what function would you suggest me to read the file and have frequency and data in an array?
load() return this erro:
Error using load
Unknown text on line number 1 of ASCII file C3--Trace--00001.trc
"#9500000348WAVEDESC".
- I guess I should read the file
data=readMyTrcFile('C3--Trace--00001.trc')
- read frequency
f=data(:,1)
- read Amplitude
d=data(:,2)
and after plot(f,d), but how i can read this file? load doesn't work
fileread return an array "1x500000359 char" but in this case i don't have f and data. How can i proceed?
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일
Hi @Rik, thanks for the time you are dedicating to me.
I have tried to open the file with notepad and this is the result:
this is the first time that I find myself reading such files. thi file is the output of the BER(Bit Error Rate) Tester.
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.
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?
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개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Import and Analysis에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
아시아 태평양
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)