Why am I unable to open .csv file with the readmatrix function?

12 ビュー (過去 30 日間)
Poulomi
Poulomi 2022 年 6 月 10 日
コメント済み: Poulomi 2022 年 6 月 13 日
The file I am trying to import in matlab is CSV (comma delimited).
So each cell in the excel file is like:
0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 3.000
So 11 values with space in between.
Initially using matlab 2020a, readmatrix could read each value separately and could import it without any issues as a 1 x 11 double.
But now I am not able to anymore. It would just read it as 1x1 double with the value as NaN.
Any suggestions as to how I can read my excel file now?
  10 件のコメント
Stephen23
Stephen23 2022 年 6 月 12 日
@Poulomi: I used https://notepad-plus-plus.org/downloads/, but every text editor on the planet has find-and-replace functionality.
Poulomi
Poulomi 2022 年 6 月 13 日
@Stephen23 thank you!! find and replace function at notepad++ solved my problem... matlab can read the csv file now.

サインインしてコメントする。

採用された回答

Mathieu NOE
Mathieu NOE 2022 年 6 月 10 日
hello
workaround suggestions
faster with readcell vs importdata
>> tic;
out2 = str2double(split(readcell('t4md6p1 - partial file.csv')));
toc
Elapsed time is 10.480521 seconds.
>> tic;
out2 = str2double(split(importdata('t4md6p1 - partial file.csv')));
toc
Elapsed time is 34.013224 seconds.

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by