필터 지우기
필터 지우기

xlsread converts whole array to logical

조회 수: 2 (최근 30일)
John Williams
John Williams 2016년 1월 18일
답변: Rebecca Krosnick 2016년 1월 20일
I recently revisited a MatLab program from about 1 year ago and found that it no longer worked. I found the reason to be that xlsread now converts the whole numeric array to logical if the excel spreadsheet it is reading contains any true/false values. Previously it would have converted the logical values to 0 or 1 and and retained the correct values for the numeric cells. Has the behaviour of xlsread changed, and can I make it behave as it did before? I am currently using MatLab version 2015a. The previous version, with which my program worked, was 2012 a or b.
  댓글 수: 1
Walter Roberson
Walter Roberson 2016년 1월 18일
Which operating system are you reading on? In particular are you using MS Windows with Excel installed? If you are, have you tried using 'basic' mode?

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

채택된 답변

Rebecca Krosnick
Rebecca Krosnick 2016년 1월 20일
I was able to reproduce this behavior (where the whole numeric array output is actually a logical array) in MATLAB R2015a, but MATLAB R2015b seems to have the original behavior you saw in R2012a/R2012b. You may want to try R2015b if you have access.
In R2015a, a workaround is to use the "raw" output from "xlsread", for example
>> [num,txt,raw] = xlsread('myExample.xlsx');
"raw" is a cell array, but will contain the numeric and logical values you are expecting.

추가 답변 (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