Convert file with negative value and nan to double
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Mohamed Asaad
el 7 de Feb. de 2022
Comentada: Jan
el 8 de Feb. de 2022
I am using the below code to import data from another file and to convert commas to dots to be able to plot the values from different files on Matlab. This code works for me except for these two attached files where I get an error message "Conversion to double from struct is not possible." Does anyone know why it does not work for these two files and know a solution for that problem?
a1_Au1EchemPEG = importdata('Au_1_E_chem_experiment_SPR_angle_offset_after_PEG.dat');
b1_Au1EchemPEG = strrep(a1_Au1EchemPEG,',','.');
c1_Au1EchemPEG = cell2mat(cellfun(@str2num,b1_Au1EchemPEG,'un',0));
0 comentarios
Respuesta aceptada
Jan
el 7 de Feb. de 2022
importdata is extremely smart.Try this:
S = fileread('Au_1_E_chem_experiment_SPR_angle_offset_after_PEG.dat');
S = strrep(S, ',', '.');
D = sscanf(S, '%g', [2, inf]);
2 comentarios
Jan
el 8 de Feb. de 2022
@Mohamed Asaad: The new file starts with a header line, which contains the names of the columns. You can open your .dat files with a text editor to check this.
Más respuestas (0)
Ver también
Categorías
Más información sobre Large Files and Big Data en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!