Clear Filters
Clear Filters

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

1 view (last 30 days)
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');
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!
Walter Roberson
Walter Roberson on 15 Dec 2022
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.

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!