How to store strings into array?
Mostra commenti meno recenti
I am reading filename from directory and want to store it into array.
srcFiles = dir('E:\abc\*.bmp'); % the folder in which ur images exists
for i = 1 : length(srcFiles)
filename = strcat('E:\abc\',srcFiles(i).name);
names(i,:)=filename;
end
I am getting following error ??? Undefined function or variable 'names'.
3 Commenti
Why waste your time with a loop anyway ?
P = 'E:\abc\';
S = dir(fullfile(P,'*.bmp');
N = {S.name};
F = fullfile(P,N)
Azzi Abdelmalek
il 26 Ago 2016
You don't need cellfun
F=fullfile(P,N)
Stephen23
il 26 Ago 2016
@Azzi Abdelmalek: thank you, I changed the comment.
Risposta accettata
Più risposte (1)
Azzi Abdelmalek
il 26 Ago 2016
names=fullfile('E:\abc\',{srcFiles.name})
Categorie
Scopri di più su Characters and Strings in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!