gpt4 book ai didi

matlab - 使用小数逗号而不是小数点读取 Excel 文件 (Excelfinlename.dvd)?

转载 作者:太空宇宙 更新时间:2023-11-03 20:35:38 25 4
gpt4 key购买 nike

目前我正在尝试读取具有两个不同结尾的 excel 文件。 dvd & .sod(来自 SCADA 系统)。我正在使用 [Values] = xlsread(File_to_Open) 来这样做。我的问题是:在 excel 文件中,我有这样写的值(示例:21,1),逗号不是点(我使用的是德语 Windows 系统),当我将这些数据导入 matlab 时,我得到的是 37,我不知道为什么!你能帮我解决这个在使用 xlsread() 函数时导入的问题吗?

Example for my Excel Data is as following:
Date Hour Minute Second PlantNo Error arDevV1 arDevV2 Temp.
01.07.2013 0 0 0 1 0 0,0 0,0 20,1
01.07.2013 0 0 0 2 0 0,0 0,0 20,6
01.07.2013 0 0 0 3 0 0,0 0,0 20,4
01.07.2013 0 0 0 4 0 0,0 0,0 20,7
01.07.2013 0 0 0 5 0 0,0 0,0 20,9
01.07.2013 0 0 0 6 0 0,0 0,0 20,6
01.07.2013 0 0 0 7 0 0,0 0,0 163,2
01.07.2013 0 1 0 1 0 0,0 0,0 20,1
01.07.2013 0 1 0 2 0 0,0 0,0 20,5
01.07.2013 0 1 0 3 0 0,0 0,0 20,3
01.07.2013 0 1 0 4 0 0,0 0,0 20,7

我在 matlab 中得到以下内容:

0   0   0   1   0   0   0   37
0 0 0 2 0 0 0,400000000000000 38
0 0 0 3 0 0 0 -43,6000000000000
0 0 0 4 0 0 0 37,8000000000000
0 0 0 5 0 0 0,300000000000000 39,5000000000000
0 0 0 6 246 0 0 0
0 0 1 7 0 0 0 38,8000000000000
0 1 0 1 0 0 0 37
0 1 0 2 0 0 0,400000000000000 38
0 1 0 3 0 0 0 -43,6000000000000
0 1 0 4 0 0 0 37,8000000000000
0 1 0 5 0 0 0,300000000000000 39,5000000000000
0 1 0 6 246 0 0 0
0 1 1 7 0 0 0 38,7000000000000
0 2 0 1 0 0 0 36,9000000000000
0 2 0 2 0 0 0,400000000000000 38

最佳答案

仅使用 Matlab:

您可以尝试使用原始输出并将逗号替换为点。您将原始数据作为 xlsread 的第三个输出:

[num,txt,raw] = xlsread(_) additionally returns the text fields in cell array txt, and the unprocessed data (numbers and text) in cell array raw using any of the input arguments in the previous syntaxes. If xlRange is specified, leading blank rows and columns in the worksheet that precede rows and columns with data are returned in raw.

在我看来,更好的做法是在 Excel 中将逗号更改为点。目前,matlab(或 xlsread)正在将数据解释为其他东西。

关于matlab - 使用小数逗号而不是小数点读取 Excel 文件 (Excelfinlename.dvd)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17965126/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com