Using readtable to import a 5x1 column from Excel is missing one element. Why??
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Emmanuel J Rodriguez
le 24 Nov 2021
Commenté : Emmanuel J Rodriguez
le 24 Nov 2021
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 commentaires
Réponse acceptée
Dave B
le 24 Nov 2021
Modifié(e) : Dave B
le 24 Nov 2021
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)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!