I try to import one single point from 20 different mat file and save those point into a mat file without overwrite it. However my code keep overwritting it and only display the last value. Here is my code
for k = 1:20 myfilename = sprintf('Image%d.mat', k); a = load(myfilename); newimg = (a.img -273); % The point of plants
i = 100; j = 84; % Take the average of itself and all four of its neighboring
% values average each point in array
newimg(i,j) = 0.2*(newimg(i+1,j) + newimg(i-1,j) + newimg(i,j+1) + newimg(i,j-1) + newimg(i,j)) val = newimg(i,j) newa = length(k); save('newa.mat','-append','val');end
Best Answer