Problem with concatenation, help me

1 Ansicht (letzte 30 Tage)
Daniel Fonsêca
Daniel Fonsêca am 22 Mai 2018
Bearbeitet: Stephen23 am 23 Mai 2018
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 Kommentare
Daniel Fonsêca
Daniel Fonsêca am 22 Mai 2018
I have 6 files which I want read and put the datas into cell array called da.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Stephen23
Stephen23 am 23 Mai 2018
Bearbeitet: Stephen23 am 23 Mai 2018
[~,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

Kategorien

Mehr zu Downloads finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by