readtimetable does not read the entire Excel file

6 visualizaciones (últimos 30 días)
Per Westerlund
Per Westerlund el 17 de Nov. de 2023
Comentada: Per Westerlund el 17 de Nov. de 2023
I have several Excel files with date and time and then some ten columns. The number of lines is 9000.
When I read them with readtimetable, I get them correct in six cases. The other four get cut at line 2881, 4345, 745 and 745 respectively. The first problematic one had dashes instead of the values in a column from the point that it did not work. I put 0 there and still it does not work.
What more can I try?
  7 comentarios
Cris LaPierre
Cris LaPierre el 17 de Nov. de 2023
I don't see any issues importing this file either. Do you?
Per Westerlund
Per Westerlund el 17 de Nov. de 2023
The file has 2992 rows of data and I get only 2881 rows when I import it.

Iniciar sesión para comentar.

Respuesta aceptada

Drew
Drew el 17 de Nov. de 2023
Editada: Drew el 17 de Nov. de 2023
Your .xls file has a hidden worksheet before the visible worksheet. The hidden worksheet has fewer rows. By default, readtable is reading the first worksheet, which happens to be hidden. You can specify the worksheet name to read the visible worksheet you are looking for, and the result has 2992 rows as expected.
f2017t = readtimetable("n_fot2017-01-12 mod del.xls","Sheet","Förb + prod i Sverige", "VariableNamingRule", "preserve")
f2017t = 2992×10 timetable
Tid Total förbrukning Vindkraft Vattenkraft Kärnkraft Gasturbin/diesel Övr.värmekraft Ospec. prod. Solkraft Total produktion Import/export ____________________ _________________ _________ ___________ _________ ________________ ______________ ____________ ________ ________________ _____________ 01-Jan-2017 00:00:00 -13339 3637.8 2415.8 9074.4 0.85744 1125.7 0.92037 0.035938 16256 -2919.6 01-Jan-2017 01:00:00 -13047 3429.5 2381.2 9074.7 0.85076 1076.5 1.1083 0.035288 15964 -2920.3 01-Jan-2017 02:00:00 -12824 3290 2355.1 9074.9 0.84465 1095.5 1.0244 0.026189 15817 -2996.5 01-Jan-2017 03:00:00 -12668 3053.2 2268 9077.4 0.82665 1142.3 0.9999 0.019635 15543 -2878.1 01-Jan-2017 04:00:00 -12629 2932.2 2311 9078 0.80068 1158.5 0.87338 0.018089 15481 -2855.7 01-Jan-2017 05:00:00 -12708 2787.2 2327.5 9079.9 0.67075 1169.1 0.69828 0.017403 15365 -2660 01-Jan-2017 06:00:00 -12924 2661.7 2555.7 9082.6 0.63896 1195.5 0.00409 0.019086 15496 -2573.9 01-Jan-2017 07:00:00 -13227 2611 2727.8 9082.7 0.57101 1184.2 0.67683 0.023495 15607 -2382.6 01-Jan-2017 08:00:00 -13588 2553.5 2860 9082.7 0.55226 1165.9 0.61035 0.025813 15663 -2077.1 01-Jan-2017 09:00:00 -13897 2392 3300.6 9084.7 0.62331 1195.9 0.10089 0.1066 15974 -2078.9 01-Jan-2017 10:00:00 -14494 2243 3561.6 9085.5 1.0216 1212.7 0.00508 0.90292 16105 -1612.9 01-Jan-2017 11:00:00 -14951 2080.4 3758.2 9082.8 0.96721 1221 0.00387 2.4625 16146 -1197 01-Jan-2017 12:00:00 -15218 1968.2 4095.8 9085.3 1.0963 1217.6 0.00167 2.5767 16371 -1153.4 01-Jan-2017 13:00:00 -15435 2011.4 4181.4 9085.1 1.0842 1232.6 0.0002 1.7942 16513 -1079 01-Jan-2017 14:00:00 -15741 2076.3 4355.6 9084.7 0.97908 1246 9e-05 0.43023 16764 -1023.3 01-Jan-2017 15:00:00 -16477 2106.2 4841 9084.4 0.94576 1242.9 0.00044 0.047412 17276 -799.64
If this answer helps you, please remember to accept the answer.

Más respuestas (0)

Productos


Versión

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by