Filter löschen
Filter löschen

Info

Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.

generation of vector using for loop

1 Ansicht (letzte 30 Tage)
muthu kumar
muthu kumar am 15 Feb. 2012
Geschlossen: MATLAB Answer Bot am 20 Aug. 2021
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

Antworten (1)

Andrei Bobrov
Andrei Bobrov am 15 Feb. 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 Kommentar
muthu kumar
muthu kumar am 16 Feb. 2012
thank u very much . now i got the idea

Diese Frage ist geschlossen.

Community Treasure Hunt

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

Start Hunting!

Translated by