Importing rows with empty cels from EXCEL

2 ビュー (過去 30 日間)
Can Sever
Can Sever 2016 年 5 月 9 日
回答済み: dpb 2016 年 5 月 9 日
Dear all, I am trying to export rows with empty cells in several first elements. For instance a row in excel is [ _ _ 4 5 6]; first 2 cells being empty, Matlab reads this a=[4 5 6], it does not insert NaN's, and makes size 3, instead of 5. Is there a way to fix this?
Best regards, Can Sever University of Maryland
  1 件のコメント
Can Sever
Can Sever 2016 年 5 月 9 日
Since I have thousans of column with unbalanced data, this is a big problem for me. Thanks in advance!

サインインしてコメントする。

回答 (1 件)

dpb
dpb 2016 年 5 月 9 日
With xlsread alone the only way is to specify the range and return the raw data cell array. There may be a way with the COM/DDE/ActiveX but that's more of an Excel question than Matlab as far as communication protocols/methods.
Example; made a one-row spreadsheet as you described--
>> [x,t,r]=xlsread('book1.xls','A1:E3')
x =
1 2 3
t =
{}
r =
[NaN] [NaN] [ 1] [ 2] [ 3]
[NaN] [NaN] [NaN] [NaN] [NaN]
[NaN] [NaN] [NaN] [NaN] [NaN]
>>

カテゴリ

Help Center および File ExchangeSpreadsheets についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by