Saving variables after every iteration.

1 view (last 30 days)
Kijek
Kijek on 11 Dec 2017
Edited: Kijek on 5 Jan 2018
hello. im doing my diploma project, and i dont know what do. i spent few hours to get the solution, but have no idea how to solve it. the last line of my code save the last iteration and i understand why. the problem is how to save every iteration.
numImages = numel(sciezka(1).Files) %tu wyciaga ile jest zdjec w folderze
tabela=[];
for i = 1:numImages
C=(readimage(sciezka,i)); %wczytujesz fote
vektorekpunkciki=detectSURFFeatures(C);
punktydlastania=selectStrongest(vektorekpunkciki, 20)
trainingFeatures = extractFeatures(C, punktydlastania);
tabela(i)=trainingFeatures(i)
end

Accepted Answer

Guillaume
Guillaume on 11 Dec 2017
Edited: Guillaume on 11 Dec 2017
That line
tabela(i)=trainingFeatures(i)
makes no sense at all. It stores numImages value in tabela , but for image i, it stores the 1st point of the ith feature vector and nothing else. I suspect you wanted either:
tabela = zeros(20, 64, numImages); %store feature vectors as 3d matrix.
for i = 1:numimages
%...
tabela(:, :, i) = trainingFeatures;
end
You then get the feature vector for a given image with
tabela(:, :, imagenumber)
Or you can use
tabela = cell(1, numImages);
for i = 1:numimages
%...
tabela{i} = trainingFeatures;
end
You then get the feature vector for a given image with
tabela{imagenumber}

More Answers (0)

Community Treasure Hunt

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

Start Hunting!