Avoid overwriting value of variable
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ghenji
am 14 Feb. 2018
Bearbeitet: Stephen23
am 14 Feb. 2018
I am having following code:
Source_files = [specified directory]
len = length(Source_files);
for j = 1 : len
[status,sheets] = xlsfinfo(Source_files)
sheetIndex = find(strncmp(sheets, '#', 1));
end
sheetIndex variable's value gets overwritten on every iteration. I want to have a variable wanted_sheets constituting names of all the sheets starting with '#' from all the files.
0 Kommentare
Akzeptierte Antwort
Stephen23
am 14 Feb. 2018
Bearbeitet: Stephen23
am 14 Feb. 2018
Use indexing:
Source_files = [specified directory]
N = numel(Source_files);
C = cell(1,N);
for k = 1:N
[status,sheets] = xlsfinfo(Source_files{k});
C{k} = find(strncmp(sheets, '#', 1));
end
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Audio and Video Data 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!