How can I read a matrix contain '?'
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MED
el 7 de Dic. de 2013
Comentada: MED
el 7 de Dic. de 2013
I want to read file txt and replace '?' in the current matrix with 0 exempl
File containing this matrix :
A;B;C
?;7;9
9;?;1
1;8;5
==>
A;B;C
0;7;9
9;0;1
1;8;5
0 comentarios
Respuesta aceptada
Walter Roberson
el 7 de Dic. de 2013
fid = fopen('filename.txt')
d = textscan(fid,'%f%f%f', 'Delimiter', ';', 'TreatAsEmpty', '?', 'EmptyValue', 0, 'CollectOutput', 1)
fclose(fid)
out = d{1};
Más respuestas (1)
Azzi Abdelmalek
el 7 de Dic. de 2013
fid=fopen('filename.txt')
d=textscan(fid,'%s')
fclose(fid)
out=strrep(d{1},'?','0')
3 comentarios
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!