Error in readtable function.

조회 수: 4 (최근 30일)
John Carroll
John Carroll 2021년 2월 17일
댓글: John Carroll 2021년 2월 17일
I was given a .csv file of data and exported it to a .xlsx file to my desktop. My matlab code now will not read the table and i am unsure why. I have attached the file to this question as well. i had run into an issue earlier where if i had the same file open more than once the code would not run. I closed everything and started matlab back up and this code will still not run. Im sure this is probably an easy fix as this is my second week using matlab and I am still learning the ins and outs. Thanbk You!
my code is as follows:
Y2 = readtable('1hz000.xlsx','Range','E1:AJ12');
oneHZ = table2array(Y2);
two = detrend(oneHZ);
for i=1:32
[pks] = findpeaks(one(:,i));
meanWH(i) = mean(pks);
end
mn1 = mean(meanWH);
WH2 = mn1*2

채택된 답변

Cris LaPierre
Cris LaPierre 2021년 2월 17일
편집: Cris LaPierre 2021년 2월 17일
readtable appears to be working just fine.
There are, however, some errors with your code.
  • There are only 7 rows of data, yet you read in 12. The extra rows will be filled with NaN.
  • The variable one does not exit. This causes an error for me.
Have you gone through MATLAB Onramp yet? Ch 11 covers importing data.
  댓글 수: 3
Cris LaPierre
Cris LaPierre 2021년 2월 17일
편집: Cris LaPierre 2021년 2월 17일
Is the file located in your current folder in MATLAB? If not, you must include the full path to the file in the filename (or add the folder containing the file to your MATLAB path).
Add Ch 3 the the chapters you should go through in Onramp.
John Carroll
John Carroll 2021년 2월 17일
Awesome much appreciated! Got it!

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Whos에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by