Using readtable to import a 5x1 column from Excel is missing one element. Why??
4 次查看(过去 30 天)
显示 更早的评论
I feel like this should be a super easy fix. This is a simple import using readtable, the f3 variable below only brings in a 4x1 column vector when all others bring in a 5x1 (as it should be). Why?
f1 = readtable("Copy - DOE Input Data Set #1 -updated.xlsx",'Range','C30:C34');
f2 = readtable("Copy - DOE Input Data Set #1 -updated.xlsx",'Range','D30:D34');
f3 = readtable("Copy - DOE Input Data Set #1 -updated.xlsx",'Range','E30:E34');
f4 = readtable('Copy - DOE Input Data Set #1 -updated.xlsx','Range','F30:F34');
Excel file attached.
0 个评论
采纳的回答
Dave B
2021-11-24
编辑:Dave B
2021-11-24
readtable detected the first value as a variable name
Just add 'ReadVariableNames', false to your call to readtable (if you don't specify, MATLAB will guess. f1,f3,f4 were all numeric so MATLAB guessed they weren't variable names).
fn = "https://www.mathworks.com/matlabcentral/answers/uploaded_files/811514/Copy%20-%20DOE%20Input%20Data%20Set%20%231%20-updated.xlsx"
f3 = readtable(fn,'Range','E30:E34') % MATLAB guesses that (the first) LB is the Variable Name
f3 = readtable(fn,'Range','E30:E34','ReadVariableNames',false)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spreadsheets 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!