How can I load and save a excel data file (which has negative values in some rows) in MATLAB as an executable double. I tried and it gives me NAN for negative values. Here is the file. Thanks.

조회 수: 1 (최근 30일)
Hello I am using MATLAB 2018a. How can I load and save a excel data file (which has negative values in some rows) in MATLAB as an executable double. I tried and it gives me NAN for negative values. Here is the file. Thanks.

채택된 답변

the cyclist
the cyclist 2018년 10월 15일
The problem is that in the Excel file, those are not negative signs in those numbers -- they are dashes or some other character. Therefore, they are interpreted as text, not as numbers.
If you globally replace those characters with negative signs (i.e. hyphens), then
x2 = xlsread('index2.xlsx')
will read it just fine. I've done that in the attached file.
  댓글 수: 4
the cyclist
the cyclist 2018년 10월 15일
What I did to create my index2 file was to go into a single cell, and copy that dash symbol onto the clipboard. Then I did a global replace with a hyphen, and save.
az
az 2018년 10월 15일
Thank you Cyclist, it works, and now on I am changing all file in excel for -ve to hyphen.

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

추가 답변 (1개)

madhan ravi
madhan ravi 2018년 10월 15일
편집: madhan ravi 2018년 10월 15일
[num,~,~] = xlsread('index.xlsx')
Datas = num
Now we can manipulate the data’s as we want.
  댓글 수: 5
az
az 2018년 10월 15일
Thank you ravi for quick response, but still NAN remains after running this code.

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

카테고리

Help CenterFile Exchange에서 Data Import from MATLAB에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by