generation of vector using for loop
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
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
Respuestas (1)
Andrei Bobrov
el 15 de Feb. de 2012
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 comentario
muthu kumar
el 16 de Feb. de 2012
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!