I have an Excel sheet with headers of different depths and the numbers are not being read (ex.: d=-12.82m is being read as x_12_82M),
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to convert from Excel to a different format, for different depths but the headers are not being read properly.
I even tried changing it manually in Excel but if I do, they will be read as part of the data and not as headers
1 Kommentar
Akzeptierte Antwort
Chunru
am 20 Nov. 2023
% The first row is treated as var names. Use preserve to keep the original
% format
a = readtable("https://www.mathworks.com/matlabcentral/answers/uploaded_files/1544212/Sample.xlsx", "VariableNamingRule", "preserve")
s = a.Properties.VariableNames; % get the variable names
whos
d = cellfun(@(x) sscanf(x, "%f"), s(2:end) ) % convert to depth
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!