필터 지우기
필터 지우기

convert .dat files into .txt or .xls files

조회 수: 11 (최근 30일)
Laura Paletto
Laura Paletto 2018년 7월 10일
댓글: Guillaume 2018년 7월 10일
Hi all, I am collecting spectra from a system that outputs data as .dat file. I'd like to convert these files in .txt or .xls to plot them. I tried this
clear all
close all
filename = 'finale100.dat';
A = importdata(filename);
Npoints = A.data(1);
for ii = 1:Npoints
intensity(ii,1) = str2num(A.textdata{8+ii});
end
plot(intensity)
but it's not working. I cannot attach it as it won't let me upload the .dat file.. Any suggestions please?
  댓글 수: 13
Adam
Adam 2018년 7월 10일
편집: Adam 2018년 7월 10일
Just open it in any text editor (I use Notepad++, but basic Notepad would work) to see if it is binary or ascii. If it is human-readable then it is ascii. If it is full of symbols and junk it is binary. If A looks right though then again, it looks like your code on this line:
intensity(ii,1) = str2num(A.textdata{8+ii});
is not extracting the correct results from it. Why is there a hard-coded 8 in there?
Guillaume
Guillaume 2018년 7월 10일
Just open it in any text editor
Or attach it here after renaming it. We'll tell you.

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by