フィルターのクリア

importing data in utf-8 format

19 ビュー (過去 30 日間)
Huugin
Huugin 2013 年 6 月 11 日
編集済み: MathWorks Support Team 2021 年 2 月 19 日
Hi
I am trying to import this sheet of data. I am using the load function example = load('data.txt') And this works splendid as long as the text file is saved as ANSI. However, when I save the textfile as UTF-8 it does not work, and complains about unknown text.
I have tried the following without success tried1 = load('data.txt', '-utf-8') tried2 = load('data.txt', 'utf-8') tried3 = load('data.txt', '-UTF-8') tried4 = load('data.txt', 'UTF-8')
Any suggestions? and many thanks :-)

回答 (2 件)

MathWorks Support Team
MathWorks Support Team 2021 年 2 月 19 日
編集済み: MathWorks Support Team 2021 年 2 月 19 日
As of R2020a, virtually all of MATLAB’s file I/O routines, including fopen, fileread, readmatrix, readtable, etc., now handle UTF-8 encoded files with no additional user action.

Walter Roberson
Walter Roberson 2013 年 6 月 11 日
編集済み: Walter Roberson 2013 年 6 月 11 日
Do not use load() for it. load() of text files is documented as only working if the files are in the format used by save -ASCII, and files that contain UTF-8 are not in the format.
You can probably use textscan() on the files. You might also be able to use uiimport()

カテゴリ

Help Center および File ExchangeText Files についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by