How do you read a column from a csv file that has commas?

5 ビュー (過去 30 日間)
tng
tng 2021 年 3 月 31 日
編集済み: tng 2021 年 3 月 31 日
I want to read column 19 of the table (surface elevation) into MATLAB but I get a table with characters rather than numbers when I write this:
tidedata1 = readtable('Newhaven_19820101_19871231.csv');
When I check tidetdata1(:,19), it has character showing as '-99.000',
How do you get rid of the 3 commas and convert the column to numbers so that I can use it for calculations? I'd highly appreciate an example using my file (for this column if possible).

採用された回答

tng
tng 2021 年 3 月 31 日
編集済み: tng 2021 年 3 月 31 日
B = readtable('Newhaven_19820101_19871231.csv', 'Delimiter', ',');
B = B(:,11);
B = table2array(B);
Actually this seems to work.

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by