Save as separate file with separate name in txt
2 ビュー (過去 30 日間)
古いコメントを表示
ds=dataset(‘xlsfile’,’prov.xlsx’);
f1=ds.rem(1:451);
f2=ds.name(1:451);
for i=1:451
if f1(i)==1
%name
c(i)=f2(i);
save('/Users/desktop/c(i)' '.txt','f1')
end
end
I want to have all 1 values in separate file with special name.
8 件のコメント
Geoff Hayes
2019 年 3 月 6 日
Vania - I don't understand why you are getting a string like '/Users/Desktop/myfolder/0.txt/Users/Desktop/myfolder/102.txt/Users/Desktop/myfolder' which appears to be a concatenation of several attempts to create files. You may need to post more of your code or try moving the sprintf out of the save to get something like
for i=1:451
if f1(i)==1
%name
c(i)=f2(i);
filename = sprintf('/Users/desktop/%d.txt', f2(i));
save(filename,'f1')
end
end
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で String Parsing についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!