Convert string cell array to string literal
16 views (last 30 days)
Show older comments
fileval = 'xxx_yyy_zzz'
nm1parts = split(fileval,'_');
fpart = '';
for ii = 1:length(nm1parts)
if ii~=length(nm1parts)
%fpart = fpart + string(nm1parts{ii}) + '\'
fpart = strcat(fpart, string(nm1parts{ii}), filesep);
else
%fpart = fpart + string(nm1parts{ii})
fpart = strcat(fpart, string(nm1parts{ii}));
end
end
whos fpart
nmdir = 'C:\Users\train'
mnm0 = [nmdir filesep fpart '.obj']
Here is my code, when I am trying to append to get the file path, it creates string cell array rather than a single string. Please help
output of mnm0- mnm0 =
1×4 string array
"C:\Users\train" "\" "xxx\yyy\zzz" ".obj"
what I want is - 'C:\Users\train\xxx\yyy\zzz.obj"
0 Comments
Answers (1)
See Also
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!