Working in international team causes problems reading csv files

1 次查看(过去 30 天)
Hi We are an international team of Matlab users working on a project. Every user has its own notebook, some with European, some with American local settings. Reading csv-files using xlsread is causing problems, as the formatting of figures is different. Is there another fast way of reading csv-files with numbers and strings without running in this problem? The solution as proposed in this forum of adjusting the region settings is a no-go-option. Thanks Renger

采纳的回答

Nayan Rao
Nayan Rao 2018-6-5
编辑:Walter Roberson 2018-6-7
As seen in the folwoing link 'xlsread' only supports 7-bit ASCII in xlsx files https://www.mathworks.com/help/matlab/ref/xlsread.html#btjfnq9-7 and hence the discrepancy! As a work around you can use the 'textscan' function in MATLAB- https://www.mathworks.com/help/matlab/ref/textscan.html?searchHighlight=textscan&s_tid=doc_srchtitle
I believe this should solve the issue. Let me know if you face any issues.
  2 个评论
Walter Roberson
Walter Roberson 2018-6-5
Note that if you plan to use textscan() with functions that use characters beyond 255, then you should probably pass in the UTF encoding as a parameter to fopen().
See https://www.mathworks.com/matlabcentral/answers/270857-how-to-read-16-bit-text-with-matlab#answer_211879 which includes a reference to code I posted to detect UTF encoding.
See also https://www.mathworks.com/matlabcentral/answers/285186-importing-data-without-knowing-number-of-columns#comment_368710 where I posted code that uses this together with knowledge of what release supports what facility in order to read in UTF-encoded csv files and do a smart conversion to table form.
That said...
My interpretation was that the problem was likely to do with the fact that some countries use comma as the decimal point; and that datetime() can only handle limited forms of named month abbreviations and only if passed the right locale that was used in constructing the names of the months (which requires the user or code to know that information.) datetime() cannot, for example, handle using Mär or Mrz as a month name (German) see https://www.mathworks.com/matlabcentral/answers/98832-why-does-datenum-give-me-an-error-message-when-i-pass-german-date-strings-as-input-arguments-in-matl

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with MATLAB 的更多信息

标签

产品


版本

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by