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!