Why does Matlab turn values of 100 into 1 when importing from csv files?

3 ビュー (過去 30 日間)
lil brain
lil brain 2022 年 12 月 15 日
編集済み: lil brain 2022 年 12 月 15 日
Hi,
I use the following code to import data from csv files.
[file_list,path_n] = uigetfile('*.csv', 'Grab csv', 'Multiselect','on');
file_list = cellstr(file_list);
N = numel(file_list);
alldata = cell(1,N);
for ii = 1:N
G = fullfile(path_n,file_list{ii});
alldata{ii} = readcell(G, 'Delimiter',{',',';'}, 'ConsecutiveDelimitersRule','join');
end
However, when I go into the cell array alldata (see attached), I see that the values that were previously 100s are now 1s.
One of the many csv files I imported where this happens is 1411_task.csv which is the second cell in alldata (see attached). If I open the file in Notepad for example I can see that the values are actually "100". Any idea why that is the case and how I could fix it in my code?
Thank you!
  10 件のコメント
lil brain
lil brain 2022 年 12 月 15 日
Sorry for the confusion and thanks for the help @Voss @Torsten and @Jan!
Walter Roberson
Walter Roberson 2022 年 12 月 15 日
I opened the file with BBEdit, which is a quite decent editor for Mac. The number 100 appears in only three places:
  • second column of line 5
  • second column of line 6
  • first column of a line in which 100 is the value of the first column
I also had my system display the file as a text file; those lines definitely end in ;1; not in 100.

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

回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by