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

3 visualizaciones (últimos 30 días)
lil brain
lil brain el 15 de Dic. de 2022
Editada: lil brain el 15 de Dic. de 2022
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 comentarios
lil brain
lil brain el 15 de Dic. de 2022
Sorry for the confusion and thanks for the help @Voss @Torsten and @Jan!
Walter Roberson
Walter Roberson el 15 de Dic. de 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.

Iniciar sesión para comentar.

Respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by