Cell to String
6 次查看(过去 30 天)
显示 更早的评论
Hi,
I am trying to concatenate a two strings in the below code:
baseDIR = 'C\Documents and Settings\User\Desktop\';
tstFeats = {'PostEq', 'AEC'};
refDir = strcat(baseDIR, tstFeats);
fileList = dir([refDir '\*.wav']);
the command dir does not work on input of type cell. I would like to convert the type cell to string to enable the working of the above code.
If I replace tstFeats = {...} with tstFeats = [...], the code works fine. But all elements in the second case need to be of the same length if I need to make a column vector.
Any help is appreciated.
Thank you.
0 个评论
回答(1 个)
Walter Roberson
2012-3-7
There does not seem to be much point in this, as dir() can only accept a single specification per call.
Please also recall that the structure of information returned by dir() does not indicate the directory anywhere, so if you did somehow manage to get dir() to look in two directories on the same call, you would not be able to tell which directory any particular returned file name had come from.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 File Operations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!