Effacer les filtres
Effacer les filtres

Error when selecting variables from an Excel sheet

4 vues (au cours des 30 derniers jours)
Mohamed Ahmed
Mohamed Ahmed le 23 Avr 2022
Commenté : Mohamed Ahmed le 23 Avr 2022
The code line
opts = spreadsheetImportOptions("VariableNamesRange",5, ...
"SelectedVariableNames",{'Sample Name'})
returns
Unknown variable name: 'Sample Name'.
opts = matlab.io.spreadsheet.SpreadsheetImportOptions(varargin{:});
Why am I receiving this error message? And any help to solve this problem will be much appreciated. Many thanks in advance.

Réponse acceptée

Simon Chan
Simon Chan le 23 Avr 2022
Better to define the Variable Names already in the spreadsheet as follows:
opts = spreadsheetImportOptions("VariableNamesRange",5, 'VariableNames',{'Var1','Var2','Sample Name','Var3'}...
"SelectedVariableNames",{'Sample Name'})
  1 commentaire
Mohamed Ahmed
Mohamed Ahmed le 23 Avr 2022
Yes, thank you Simon. I'll do that. Much appreciated.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Data Import from MATLAB dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by