How can I read a matrix contain '?'
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2013-12-7
fid = fopen('filename.txt')
d = textscan(fid,'%f%f%f', 'Delimiter', ';', 'TreatAsEmpty', '?', 'EmptyValue', 0, 'CollectOutput', 1)
fclose(fid)
out = d{1};
更多回答(1 个)
Azzi Abdelmalek
2013-12-7
fid=fopen('filename.txt')
d=textscan(fid,'%s')
fclose(fid)
out=strrep(d{1},'?','0')
3 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Large Files and Big Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!