m=str2num(char(extractBetween(myfolderinfo(i).name,'_','.')));
Assign a part of file name to a variable
5 次查看(过去 30 天)
显示 更早的评论
myfolderinfo = dir('some_random_folder') ;
N = length(myfolderinfo) ;
for i = 3:N
thisfile = myfolderinfo(i).name
some_random_folder contains text files with names 5_5.txt,6_6.txt...50_50txt,50_51.txt
now i want to assign the value after underscore to a variable m. such as for file 5_5.txt then m=5 and for file 50_51.txt then m=51
how can i assign those values to m
0 个评论
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Report Generator 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!