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
댓글 수: 0
채택된 답변
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
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 Center 및 File Exchange에서 Spreadsheets에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!