HTMLのテーブルを​読み取ると、日本語が​文字化けしてしまいま​す。

日本語の文字を含むHTMLをreadtableを実行してテーブルを読み取ったとき、日本語が文字化けしてしまうのはなぜですか?
以下のコマンドを実行し読み取りました。
opt = htmlImportOptions('TableSelector',"//TABLE[1]");
table = readtable(url,opt);

 채택된 답변

Kojiro Saito
Kojiro Saito 2022년 12월 1일
편집: Kojiro Saito 2022년 12월 1일

2 개 추천

エンコードが合っていないためだと思われます。readtableにweboptionsも引数に入れられるので、日本語の文字コードを指定してみたらどうでしょうか。
webopts = weboptions('CharacterEncoding', 'Shift_JIS');
% webopts = weboptions('CharacterEncoding', 'UTF-8');
table = readtable(url,opt, 'WebOptions', webopts)

댓글 수: 2

一眞 青木
一眞 青木 2022년 12월 1일
ありがとうございます。ご指摘の通りにやり直したら解決しました。
Kojiro Saito
Kojiro Saito 2022년 12월 1일
解決して良かったです。

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 データ型の変換에 대해 자세히 알아보기

태그

질문:

2022년 12월 1일

댓글:

2022년 12월 1일

Community Treasure Hunt

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

Start Hunting!