Plotting an imported value vs time

조회 수: 1 (최근 30일)
Brittany
Brittany 2014년 8월 2일
답변: Star Strider 2014년 8월 2일
Hello,
I am interested in plotting a numerical value verse time. I have also attached the file I am trying to read. Here is the code I have generated so far:
fid=fopen('Sensor 1.txt');
fmt = ('%s%s%*s%*s%*s%f%*s%*s');
data = textscan(fid,fmt,'headerlines',39,'collectoutput', true,'delimiter',';');
phase = data(:,2);
dn = datenum([char(data{1,1}(:,1)) char(data{1,1}(:,2))],'mm/dd/yyyyHH:MM:SS AM');
fid=fclose(fid);
plot(dn,phase)
I am receiving the error message: Error using plot Conversion to double from cell is not possible.
Error in date (line 7) plot(dn,phase)
Any help would be greatly appreciated!
BD

채택된 답변

Star Strider
Star Strider 2014년 8월 2일
Change the phase assignment to:
phase = cell2mat(data(:,2));
and it works.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Frequency-Domain Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by