Read blank row as 0
조회 수: 3 (최근 30일)
이전 댓글 표시
What function in MATLAB can I use that reads an excel line and plots 0 when it has a blank space
댓글 수: 0
답변 (1개)
Matt Fig
2012년 9월 26일
Blank rows are read as nans with xlsread. So use
N(isnan(N))=0
댓글 수: 3
Matt Fig
2012년 9월 26일
N is the output from xlsread, assuming you have numeric data. See the help for xlsread.
help xlsread
Image Analyst
2012년 9월 27일
N = xlsread(filename);
Where there is a blank cell in the Excel worksheet, N will be NaN at those locations, and N will have valid numbers at other locations where you have valid numbers in the worksheet. Matt's code changes those matrix locations with NaN's in them from NaN to 0, as you requested. Understand?
참고 항목
카테고리
Help Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!