Filter löschen
Filter löschen

readtableが​勝手にアンダーバーで​分割するのを通常通り​コンマで分割してほし​い

9 Ansichten (letzte 30 Tage)
ALI
ALI am 7 Jul. 2023
Beantwortet: Kojiro Saito am 8 Jul. 2023
% ファイルパスの指定
file1 = 'ssim_values.csv';
file2 = 'dmos.csv';
T1 = readtable(file1)
T2 = readtable(file2)
添付のcsvファイルを読み取り、テーブルに格納するような上記のコードを実行すると、file1の方だけ、アンダーバーで分割してしまうので、file2のようにコンマで区切りたいです、どうすればいいですか?
以下、実行結果です。(一部簡略化のため消去)
T1 =
20×3 table
Var1 Var2 Var3
_______ ____ ___________________
{'I01'} 1 {'01.png,1.000000'}
{'I01'} 1 {'02.png,0.997691'}
{'I01'} 1 {'03.png,0.980043'}
{'I01'} 1 {'04.png,0.947295'}
{'I01'} 1 {'05.png,0.888258'}
{'I01'} 2 {'01.png,1.000000'}
{'I01'} 2 {'02.png,0.991826'}
{'I01'} 2 {'03.png,0.954603'}
{'I01'} 2 {'04.png,0.924066'}
{'I01'} 2 {'05.png,0.900828'}
{'I01'} 3 {'01.png,1.000000'}
{'I01'} 3 {'02.png,0.993288'}
{'I01'} 3 {'03.png,0.976569'}
{'I01'} 3 {'04.png,0.959581'}
{'I01'} 3 {'05.png,0.926680'}
{'I01'} 4 {'01.png,1.000000'}
{'I01'} 4 {'02.png,0.598222'}
{'I01'} 4 {'03.png,0.496983'}
{'I01'} 4 {'04.png,0.462533'}
{'I01'} 4 {'05.png,0.387672'}
T2 =
10125×4 table
dist_img ref_img dmos var
_________________ ___________ ____ _____
{'I01_01_01.png'} {'I01.png'} 4.57 0.496
{'I01_01_02.png'} {'I01.png'} 4.33 0.869
{'I01_01_03.png'} {'I01.png'} 2.67 0.789
: : : :
{'I81_25_03.png'} {'I81.png'} 4.3 0.526
{'I81_25_04.png'} {'I81.png'} 4.13 0.499
{'I81_25_05.png'} {'I81.png'} 3.27 0.772

Antworten (1)

Kojiro Saito
Kojiro Saito am 8 Jul. 2023
readtable のオプションでDelimiterを指定できますので、コンマで区切るように指定してみたら実現できます。
file1 = 'https://jp.mathworks.com/matlabcentral/answers/uploaded_files/1428783/ssim_values.csv';
T1 = readtable(file1, 'Delimiter', ',')
T1 = 20×2 table
Image SSIM _________________ _______ {'I01_01_01.png'} 1 {'I01_01_02.png'} 0.99769 {'I01_01_03.png'} 0.98004 {'I01_01_04.png'} 0.94729 {'I01_01_05.png'} 0.88826 {'I01_02_01.png'} 1 {'I01_02_02.png'} 0.99183 {'I01_02_03.png'} 0.9546 {'I01_02_04.png'} 0.92407 {'I01_02_05.png'} 0.90083 {'I01_03_01.png'} 1 {'I01_03_02.png'} 0.99329 {'I01_03_03.png'} 0.97657 {'I01_03_04.png'} 0.95958 {'I01_03_05.png'} 0.92668 {'I01_04_01.png'} 1

Kategorien

Mehr zu 環境と設定 finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!