Info
此问题已关闭。 请重新打开它进行编辑或回答。
generation of vector using for loop
1 次查看(过去 30 天)
显示 更早的评论
hai friends i want to convert each image as column vector and store each column vector in a matrix an form a big matrix ex each image is of the size of 80X80 .i dont know how to store these column vector in a matrix . anybody know means plz help me thanks
.....................................................
files = dir('*.tif');
num_files = numel(files);%length also used
images = cell(1, num_files);
for k = 1:num_files
images{k} = imread(files(k).name);
f=images{k};
t=size(f);
%disp(t); a=zeros(t(1)*t(2),1);
k=1;
for i=1:t(1)
for j=1:t(2)
a(k)=f(j,i);
%disp(b(j,i));
k=k+1;
end
end
--------------------------------------------
in this i want a1(k),a2(k)....or a(k) should be a matrix and i have to add each coloumn vector to that matrix . thanks
0 个评论
回答(1 个)
Andrei Bobrov
2012-2-15
try this is:
files = dir('*.tif');
num_files = numel(files);%length also used
images = arrayfun(@(k)imread(files(k).name),1:num_files,'un',0);
a1 = cellfun(@(x)x(:),images,'un',0);
a = [a1{:}];
1 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!