Import data from Excel

조회 수: 1(최근 30일)
Francis Chabot
Francis Chabot 2021년 2월 1일
댓글: Francis Chabot 2021년 2월 1일
Hello,
I'm trying to input data from Excel by column and when doing it the first data which is suppose to end up in a NaN doesn't appear.
Example:
MTBV = xlsread('G-Score','Active Data','B4:B13');
When I'm inputing it the B4 data which is suppose to be a NaN is ignored by MATLAB. This problem is only with the first data because the other ones are considered as NaN when I input them.
Best regards,
  댓글 수: 1
Francis Chabot
Francis Chabot 2021년 2월 1일
I'm getting: [2.29, 1.56, 1.87, NaN...]
Instead of getting: [NaN, 2.29, 1.56, 1.87, NaN...]

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

답변(1개)

Fangjun Jiang
Fangjun Jiang 2021년 2월 1일
xlsread() tries to be smart. It tries its best to give you the numerical data so it truncates the leading Nan. Run this to see
[Num,Txt,Raw]=xlsread('G-Score','Active Data','B4:B13')
  댓글 수: 1
Francis Chabot
Francis Chabot 2021년 2월 1일
When doing it, the array of doubles which countain the data still exclude the first data which should return as a NaN but all of the others NaNs are shown correctly.
I don't get why it doesn't return me a NaN for the first data.

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

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by