필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

generation of vector using for loop

조회 수: 1 (최근 30일)
muthu kumar
muthu kumar 2012년 2월 15일
마감: MATLAB Answer Bot 2021년 8월 20일
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

답변 (1개)

Andrei Bobrov
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
muthu kumar
muthu kumar 2012년 2월 16일
thank u very much . now i got the idea

이 질문은 마감되었습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by