imread figures from new folder created

1 view (last 30 days)
viet le
viet le on 1 Sep 2016
I created figures in the folder. then, I want to read figures again to calculate, and then save .xls file in the folder created. how to do this? this is my code, but it is not working:
for ii=0:10:360
for jj=0:10:90
view(ii,jj);
%%%create a multiple folder
newdir=sprintf('view%2dview%2d',ii,jj);
mkdir(fullfile(newdir));
%rotate masks
for i=1:36
rotate(aa,[0,0,1],1);
% print figure with rotate
filename = sprintf('Slice_%d.png', i);
print('-dpng', fullfile(newdir, filename));
pause(2);
end
%%%%%%%%calculate red pixels and save in excel file
%%%%%%%%%%%%%%%
for i = 1 : 36
filename=['D:\Matlab code RMC\zzzz\newdir\Slice_ ' num2str(i,'%01d') ];
rgbImage = imread(filename);
imshow(rgbImage);
redChannel = rgbImage(:,:, 1);
greenChannel = rgbImage(:,:, 2);
blueChannel = rgbImage(:,:, 3);
greenness = mean2(greenChannel);
% Extract the individual red, green, and blue color channels.
redPixels = redChannel == 255 & greenChannel == 0 & blueChannel == 0;
redArea(i) = sum(redPixels(:));
end
%I want to save .xls into the folder created view(ii)view(jj)
filename='test.xlsx';
A=[redArea];
xlswrite(filename,A);

Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!