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 visualización (últimos 30 días)
Mostrar comentarios más antiguos
janas
el 20 de Nov. de 2023
Comentada: janas
el 20 de Nov. de 2023
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 comentario
Stephen23
el 20 de Nov. de 2023
Please upload a sample spreadsheet by clicking the paperclip button.
Respuesta aceptada
Chunru
el 20 de Nov. de 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
Más respuestas (0)
Ver también
Categorías
Más información sobre Spreadsheets en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!