Problem with concatenation, help me
1 次查看(过去 30 天)
显示 更早的评论
Hello people, I have a problem: I'm trying to cocatenate the following
arquivo = [arquivo int2str(x) '.FIL']
But when i see the content from "arquivo", we have "CUNOV000.FIL1.FIL" I dont want this ".FIL1", only the ".FILL". after "CUNOV000"
回答(1 个)
Stephen23
2018-5-23
编辑:Stephen23
2018-5-23
[~,arquivo] = fileparts(arquivo);
arquivo = sprintf('%s%d.FIL',arquivo,x)
But there is no point in calling fileparts repeatedly in a loop:
[~,fnm] = fileparts(arquivo);
for k = 0:qarq
tmp = sprintf('%s%d.FIL',fnm,k);
[fid,msg] = fopen(tmp,'rt');
assert(fid>=3,msg)
...
fclose(fid);
end
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!