Problem with concatenation, help me

조회 수: 1 (최근 30일)
Daniel Fonsêca
Daniel Fonsêca 2018년 5월 22일
편집: Stephen23 2018년 5월 23일
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"
  댓글 수: 8
Daniel Fonsêca
Daniel Fonsêca 2018년 5월 22일
I have 6 files which I want read and put the datas into cell array called da.

댓글을 달려면 로그인하십시오.

답변 (1개)

Stephen23
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

카테고리

Help CenterFile Exchange에서 Downloads에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by