Hello, I'd like to extracts a cell range from an excel file, but I'm running into trouble.

1 回表示 (過去 30 日間)
Francisco Loera
Francisco Loera 2018 年 5 月 18 日
編集済み: Greg 2018 年 5 月 18 日
This is the code and the error: >> testprim = csvread('ejemplo_4.csv',1,9,[1,9,734,9]);
Error using dlmread (line 147)
Number of HeaderColumns is greater than number of columns in file.
Error in csvread (line 50)
m=dlmread(filename, ',', r, c, rng);

回答 (1 件)

Greg
Greg 2018 年 5 月 18 日
編集済み: Greg 2018 年 5 月 18 日
Have you read the documentation for the inputs to csvread? You've told it to skip 9 columns, and it's giving you a very clear error message that there aren't that many columns in the entire file.
My guess is you're either having 0- vs. 1- based indexing troubles, or you actually meant to read all 9 columns, but told it to skip all 9 columns.
Try either:
testprim = csvread('ejemplo_4.csv',1,8,[1,8,734,8]); % Read the 9th column only
or
testprim = csvread('ejemplo_4.csv',1,0,[1,0,734,8]); % Read all 9 columns

カテゴリ

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