readtable doesn`t work as prior version (2018b vs 2023a)
25 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
동철
am 28 Mär. 2023
Kommentiert: Walter Roberson
am 28 Mär. 2023
readtable function @2018b can read blank and numbers as text.
but @2023a cannot read like @2018b
Matlab says "you can use 'T = readtable(filename,'Format','auto')'.", but it doesn`t work at all.
Is there any other way to use readtable function @2023a like 2018b??
Para_A = readtable(app.FileEditField.Value,'sheet', 'A'); # @2018b
Para_A = readtable(app.FileEditField.Value,'sheet', 'A', 'Format', 'auto'); # @2023a --> does not work.
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 28 Mär. 2023
Use detectImportOptions to create an options structure. Use setvartype() on the structure to set the column to be either char or string. Now readtable passing in the options structure
2 Kommentare
Walter Roberson
am 28 Mär. 2023
filename = "A.xlsx";
opts = detectImportOptions(filename, 'sheet', 'Constant','VariableNamesRange',1,'DataRange', 'A2');
opts = setvartype(opts,{'Type','Name','Unit','Description'},'string');
Tab_Param = readtable(filename,opts);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Spreadsheets finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!