readtable in matlab2020 vs readtable in matlab2018
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
So, I used matlab2020 to make m file. I used readtable function. As stated in documentation starting in R2020a, the readtable function read an input file and ignores headers.
PV_Power_TABLE=readtable('PV_Power.xlsx','Range','C6:CT6');
But my friend is using matlab2018 and and headers exist in his table, and code is not working, because matlab2018 is getting data with headers. How can I change this line, to make code work in matlab2018. So I need matlab2018 to ignore headers as well as 2020. What readtable option should I use ?
0 commentaires
Réponses (2)
Cris LaPierre
le 19 Déc 2020
Modifié(e) : Cris LaPierre
le 19 Déc 2020
We can't really help you with specifics unless you share the file, as well as specify if it is R2018a or b.
With every release, readtable gets better and better at autodetecting the file format. In an older release, you will need to specify more of the import settings.
You could also have your friend use the import tool to interactively load the data, and then generate a script. You could borrow the settings from the script to determine what settings to add to your import code.
0 commentaires
Walter Roberson
le 20 Déc 2020
readtable does not ignore headers when used with those options.
Current versions of readtable use detectImportOptions automatically unless told not to. With older versions of MATLAB you can call detectImportOptions yourself.
When you use the Range option the difference between between using detectImportOptions or not is that when detectImportOptions is used then MATLAB does a better job of figuring out what Variable Name to use.
0 commentaires
Voir également
Catégories
En savoir plus sur Workspace Variables and MAT Files 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!