背景
使用caffe批量提取4096维特征,每个特征向量存在一个txt中,为了进行聚类等操作,需要将txt中列向量转换为行向量再次存入txt。
clear;clc;
current = 'C:\Users\Administrator\Desktop\FT';
A = dir(current);
for k=3:length(A)
folder = strcat(current,'\',A(k,1).name);
feature = load(folder);
[b1, b2]=size(feature);
delete(folder);
fid=fopen(folder,'w');
for i=1:b1
if i == b1
fprintf(fid,'%d',feature(i,1));
else
fprintf(fid,'%d',feature(i,1));
fprintf(fid,' ');
end
end
fclose(fid);
end
disp('Done');