Initializing a char structure for a loop
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Jacob Matthews
am 8 Mai 2015
Kommentiert: Jacob Matthews
am 8 Mai 2015
I am building up a char structure of file paths and names in a large for loop in the form
list=[]
for i =1:n
stuff
file = something
list=char(list,file)
end
My problem is that the first row of list is empty doing it like this. Is there a way to initialize a char array without creating an empty row? I can remove it afterwards but that seems messy.
And in case there is a generally better method of compiling file paths, I'm working within a pipeline that requires me to construct this.
Thanks
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 8 Mai 2015
list = cell(n, 1);
for i = 1 : n
stuff
list{i} = file;
end
list = char(list);
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Structures 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!