フィルターのクリア

Mismatch between file and format string.

14 ビュー (過去 30 日間)
reza
reza 2019 年 1 月 21 日
コメント済み: reza 2019 年 1 月 21 日
Hi there,
I am trying to read the fifth column of attached .CSV file(from row 1377 to 1192) with this simple code:
data = csvread('semga.csv');
CLOSE = data(1377:1192,5);
But I get this error:
Error using dlmread (line 147)
Mismatch between file and format string.
Trouble reading 'Numeric' field from file (row number 1, field number 1) ==>
DATE,OPEN,HIGH,LOW,CLOSE,PRICE,YCLOSE,VOL,TICKS\n
Error in csvread (line 48)
m=dlmread(filename, ',', r, c);
Error in sorting (line 8)
data = csvread('semga.csv');
What is the problem and how can I fix it?

採用された回答

Stephan
Stephan 2019 年 1 月 21 日
編集済み: Stephan 2019 年 1 月 21 日
Hi,
use readtable, then extract the data from the variable CLOSE (=column named CLOSE) in ascending order:
data = readtable('semga.csv');
CLOSE = data.CLOSE(1191:1376);
Note that your table has only 1376 entries, since the first row are variable names. So i changed
(1192:1377)
to
(1191:1376)
If needed use flip function, to get the order you want:
CLOSE = flip(CLOSE)
Best regards
Stephan
  3 件のコメント
Stephan
Stephan 2019 年 1 月 21 日
編集済み: Stephan 2019 年 1 月 21 日
you could use the round function:
CLOSE = round(CLOSE)
reza
reza 2019 年 1 月 21 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

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